<template>
<div>
	<Drawer placement="left" v-model="drawerShow" :closable="false" :mask="false" :mask-closable="false"
		:transfer="false" width="320" :inner="true" id="leftDrawer">
		<div id="leftInner">
			<div class="topBtnGroup">
				<Button @click="spatialChange">空间范围</Button>
				<Button @click="dataTreeChange">数据目录</Button>
				<img src="@/assets/icons/shrink.png" alt="X" class="iconBtn" @click="hideDrawer" />
			</div>
			<!-- 设置 -->
			<div v-show="spatialShow">
				<div id="taskDescription" style="margin-top: 20px">
					<div>
						<span>风险类型</span>
						<Input v-model="taskName" disabled></Input>
					</div>

					<!-- <div>
			<span>时间</span>
			<Input v-model="taskTime" disabled></Input>
		</div>

		<div>
			<span>地点</span>
			<Input v-model="TaskAddress" disabled></Input>
		</div>

		<div>
			<span>灾种</span>
			<Input v-model="TaskDisasterType" disabled></Input>
		</div> -->
				</div>
				<!-- 空间区划 -->
				<div id="spatialRegion" style="margin-top: 20px">
					<div class="tab-header">
						<img src="@/assets/icons/emergencyIcons/emergencyMonitor/areaIcon.png" alt="" class="iconBtn" />

						<span class="tab-title">空间范围</span>
					</div>
					<!-- <CRow class="task-monitorTable-row"> -->
					<Tabs>
						<TabPane label="区划" name="name1">
							<div class="regionBlock">
								<Cascader :data="regionCascader" change-on-select filterable class="regionCas"
									:load-data="loadRegionData" @on-change="regionChangeEvent" transfer></Cascader>
								<CButton color="info" class="system-btn-style" @click="addAreaResult('region')">添加
								</CButton>
							</div>
						</TabPane>
						<TabPane label="重点区域" name="name2">
							<div class="regionBlock">
								<!-- <Cascader 
				v-model="importantRegion"
				:data="importantRegionsList"
				hange-on-select
				filterable
				transfer
				placeholder="请选择区域..."
				@on-change="importRegionShow"
				></Cascader> -->
								<Select v-model="importantRegion" transfer @on-change="importRegionShow">
									<Option v-for="item in importantRegionsList" :value="item.value" :key="item.number"
										transfer placeholder="请选择区域..">
										{{ item.label }}
									</Option>
								</Select>
								<CButton color="info" class="system-btn-style"
									@click="addAreaResult('importantRegion')">添加</CButton>
							</div>
						</TabPane>
						<TabPane label="矢量范围" name="name3">
							<div class="regionBlock">
								<Input placeholder="添加shp矢量文件" />
								<CButton color="info" class="system-btn-style" @click="selecrShpPath">选择</CButton>
							</div>
						</TabPane>
						<TabPane label="自定义" name="name4">
							<div class="regionBlock">
								<Select v-model="customerArea" transfer>
									<Option v-for="item in customerRegionList" :value="item.number" :key="item.number"
										transfer placeholder="请选择区域">
										{{ item.geoName }}
									</Option>
								</Select>
								<CButton color="info" class="system-btn-style" @click="addAreaResult('custom')">添加
								</CButton>
							</div>
						</TabPane>
					</Tabs>
				</div>
				<!-- 区域结果 -->
				<div id="regionResult" style="margin-top: 20px">
					<div class="tab-header">
						<img src="@/assets/icons/emergencyIcons/emergencyMonitor/manageIcon.png" alt=""
							class="iconBtn" />

						<span class="tab-title">区域结果</span>

						<img src="@/assets/icons/delete.svg" class="iconBtn delete" alt="delete" @click="regionDel" />
					</div>
					<div class="spatial-region-row">
						<select multiple class="batchSelect" style="height: 150px">
							<option v-for="(itemsli, index) in regionResultList" :key="index" :title="itemsli"
								:value="itemsli.value" @click="onSelectOption(itemsli, index)">
								{{ itemsli }}
							</option>
						</select>
					</div>
				</div>
				<!-- 卫星传感器 -->
				<!-- <div id="sensorChoose">
		<div class="tab-header">
			<span class="tab-title">卫星传感器选择</span>
			<CButton
			color="info"
			class="system-btn-style"
			@click="selectAddInfo"
			>选择</CButton
			>
		</div>

		<div id="samePeriod">
			<div>
			<span>卫星</span>
			<Input
				v-model="satellites"
				placeholder="请点击“选择”勾选卫星信息"
				disabled
				:title="satellites"
			></Input>
			</div>

			<div>
			<span>传感器</span>
			<Input
				v-model="sensors"
				placeholder="请点击“选择”勾选传感器信息"
				disabled
				:title="sensors"
			></Input>
			</div>
		</div>
		</div> -->
				<!-- 产品级别 -->
				<!-- <div id="productLevel">
		<div class="tab-header">
			<span class="tab-title">产品级别</span>
		</div>
		<Select v-model="productLevel">
			<Option
			v-for="item in productLevelList"
			:value="item"
			:key="item"
			placeholder="请选择产品级别"
			>
			{{ item }}
			</Option>
		</Select>
		</div> -->
				<!-- 保存 取消 -->
				<div class="formBtnGroup" style="margin-top: 20px">
					<CButton color="info" class="system-btn-style" @click="saveEmergencyTask">保存</CButton>
					<CButton color="info" class="system-btn-style" @click="ProductProductionBtn">取消</CButton>
				</div>
			</div>
			<!-- 数据目录树 -->
			<div v-show="dataTreeShow" id="treeData">
				<div style="display: flex">
					<span style="margin-top: 5px">&nbsp;&nbsp;区域&nbsp;&nbsp;</span>
					<Select placeholder="请选择区域.." transfer clearable v-model="regionSelected"
						style="width: 200px; margin-left: 20px">
						<Option v-for="item in regionResultIDList" :value="item.regionID" :key="item.regionName">
							{{ item.regionName }}
						</Option>
					</Select>
				</div>
				<div style="display: flex; margin-top: 5px">
					<span style="margin-top: 8px">&nbsp;&nbsp;卫星&nbsp;&nbsp;</span>
					<Select placeholder="请选择卫星.." transfer clearable v-model="satelliteSelected"
						style="width: 200px; margin-left: 20px">
						<Option v-for="item in satelliteResultNameList" :value="item" :key="item">
							{{ item }}
						</Option>
					</Select>
				</div>
				<div style="display: flex; margin-top: 5px">
					<span style="margin-top: 8px">关键字</span>
					<Input search enter-button placeholder="请输入关键字..." @on-search="keySearch"
						style="width: 200px; margin-left: 21px" />
				</div>
				<div style="height: 750px">
					<Tree :data="dataTreeList" :render="renderContent" show-checkbox ref="tree" :check-strictly="true"
						@on-check-change="getTreeNodeInfo" @on-contextmenu="handleContextMenu">
						<!-- :check-strictly="true" -->
						<!-- check-strictly -->
						<template slot="contextMenu">
							<!-- 删除基础地理数据 -->
							<DropdownItem v-if="this.currentTreeNode &&
								this.currentTreeNode.checked &&
								!this.currentTreeNode.level &&
								this.currentTreeNode.title.substr(-4) == '.shp'
								" @click.native="delBasicGeographic">
								<span class="crimson-text">删除基础地理数据</span>
							</DropdownItem>
							<!-- 元数据查看 -->
							<DropdownItem v-if="this.currentTreeNode && this.currentTreeNode.path"
								@click.native="metadataView">
								<span class="crimson-text">元数据查看</span>
							</DropdownItem>
							<!-- 缩放到图层 -->
							<DropdownItem v-if="this.currentTreeNode &&
								this.currentTreeNode.checked &&
								this.currentTreeNode.level &&
								this.currentTreeNode.level.substr(0, 2) == 'L1' &&
								this.currentTreeNode.title.substr(-4) != '.shp'
								" @click.native="fixScaleMapL1A">
								<span class="crimson-text">缩放到图层</span>
							</DropdownItem>
							<DropdownItem v-if="this.currentTreeNode &&
								this.currentTreeNode.checked &&
								this.currentTreeNode.level &&
								this.currentTreeNode.level.substr(0, 2) == 'L2' &&
								this.currentTreeNode.title.substr(-4) != '.shp'
								" @click.native="fixScaleMapL1A">
								<span class="crimson-text">缩放到图层</span>
							</DropdownItem>
							<DropdownItem v-if="this.currentTreeNode &&
								this.currentTreeNode.checked &&
								this.currentTreeNode.level &&
								this.currentTreeNode.level.substr(0, 2) != 'L1' &&
								this.currentTreeNode.level.substr(0, 2) != 'L2' &&
								this.currentTreeNode.title.substr(-4) != '.shp'
								" @click.native="fixScaleMapTile">
								<span class="crimson-text">缩放到图层</span>
							</DropdownItem>
							<DropdownItem v-if="this.currentTreeNode &&
								this.currentTreeNode.checked &&
								this.currentTreeNode.level &&
								this.currentTreeNode.title.substr(-4) === '.shp'
								" @click.native="fixScaleMapShp">
								<span class="crimson-text">缩放到图层</span>
							</DropdownItem>
							<!-- 基础地理数据缩放至图层 -->
							<DropdownItem v-if="this.currentTreeNode &&
								this.currentTreeNode.checked &&
								!this.currentTreeNode.level &&
								this.currentTreeNode.title.substr(-4) == '.shp'
								" @click.native="fixBasicScaleMapShp">
								<span class="crimson-text">缩放到图层</span>
							</DropdownItem>
							<!-- 火点判读 -->
							<DropdownItem v-if="this.currentTreeNode &&
								this.currentTreeNode.checked &&
								this.currentTreeNode.level &&
								this.currentTreeNode.level.substr(0, 2) == 'L5' &&
								this.currentTreeNode.title.substr(-4) == '.shp'
								" @click.native="fireInterpretation()">
								<span class="crimson-text">火点判读</span>
							</DropdownItem>
							<!-- 样式设置 -->
							<DropdownItem v-if="this.currentTreeNode &&
								this.currentTreeNode.checked &&
								this.currentTreeNode.path &&
								this.currentTreeNode.level != 'L1A'
								" @click.native="styleOfTreeData">
								<span class="crimson-text">样式设置</span>
							</DropdownItem>
							<!-- 颜色设置 -->
							<DropdownItem v-if="this.currentTreeNode &&
								this.currentTreeNode.checked &&
								this.currentTreeNode.path &&
								this.currentTreeNode.title.substr(-4) === '.shp'
								" @click.native="shpColorView">
								<span class="crimson-text">颜色设置</span>
							</DropdownItem>
							<!-- 右侧地图 -->
							<DropdownItem v-if="this.currentTreeNode &&
								this.currentTreeNode.checked &&
								this.currentTreeNode.title.substr(-4) != '.shp'
								" @click.native="loadToRightMap">
								<span class="crimson-text">右侧地图</span>
							</DropdownItem>

							<!-- <DropdownItem v-else  disabled> 父节点不支持查看 </DropdownItem> -->
						</template>
					</Tree>
				</div>
				<div class="btnGroup">
					<Dropdown type="primary" class="but-treedata" @on-click="algoDropdownMenuChange">
						<Button type="primary" class="btnstyle textBtnStyle system-btn-style">添加
							<Icon type="ios-arrow-down"></Icon>
						</Button>
						<DropdownMenu slot="list">
							<DropdownItem name="local">本地数据</DropdownItem>
							<DropdownItem name="dataManagement">数管数据</DropdownItem>
						</DropdownMenu>
					</Dropdown>
					<!-- <Button
			type="primary"
			class="but-treedata"
			@click="basicGeographicData"
			disabled
			>基础地理数据加载
			</Button> -->

					<!-- 移除双功能按钮 -->
					<Dropdown type="primary" class="but-treedata" @on-click="deleteMenuData">
						<Button type="primary" class="btnstyle textBtnStyle system-btn-style">移除
							<Icon type="ios-arrow-down"></Icon>
						</Button>
						<DropdownMenu slot="list">
							<DropdownItem name="local">移除</DropdownItem>
							<DropdownItem name="dataManagement">删除</DropdownItem>
						</DropdownMenu>
					</Dropdown>

					<!-- <Button type="primary" class="but-treedata" @click="deleteTreeData">
			移除
			</Button> -->
				</div>
				<div class="publish">
					<Button type="primary" class="but-treedata" @click="downloadTreeData">下载
					</Button>
					<Button type="primary" class="but-treedata" @click="recoverTreeData">恢复
					</Button>
					<Button type="primary" @click="publish" style="margin-right: 7px" v-show="showPublishBtn">
						发布
					</Button>
				</div>
			</div>
			<!-- 发布 -->
			<Modal v-model="publishShow" draggable scrollable title="发布设置" :width="600">
				<h5>风险名称筛选条件:</h5>
				<div class="pubulishSetting">
					<div class="queryBox">
						<div style="margin-bottom: 15px">
							<span style="font-size: 16px">风险类型：</span>
							<Select transfer placeholder="请选择类型" disabled v-model="eventType"
								style="width: 450px; margin-left: 10px;">
								<Option v-for="item in disasterList" :value="item.value" :key="item.label">
									{{ item.label }}
								</Option>
							</Select>
						</div>
						<div style="margin-bottom: 15px">
							<span style="font-size: 16px">风险时间：</span>
							<DatePicker type="date" style="width: 450px; margin-left: 10px"
								@on-change="getEventName('eventDate')" placeholder="开始时间" format="yyyy-MM-dd"
								v-model="eventDate"></DatePicker>
						</div>
						<div style="margin-bottom: 15px">
							<span style="font-size: 16px">风险标题：</span>
							<Input v-model="eventTitle" @on-change="getEventName('eventTitle')" placeholder="事件标题"
								style="width: 450px; margin-left: 10px"></Input>
						</div>
						<div style="margin-bottom: 15px">
							<span style="font-size: 16px">风险地区：</span>
							<el-cascader v-model="eventArea" size="medium" ref="cascader"
								@change="getEventName('eventArea')" clearable placeholder="请选择地区" :props="propsParams"
								style="width: 450px; margin-left: 10px;">
								<template slot-scope="{ node,data }">
									<!--点击文本后选中整个节点-->
									<div @click="$event.srcElement.parentNode.previousElementSibling.click()">
										{{ data.label }}
									</div>
								</template>
							</el-cascader>
						</div>
					</div>
					<div style="margin-bottom: 15px">
						<span style="font-size: 16px">风险名称：</span>
						<Select placeholder="请选择名称.." transfer clearable v-model="eventId" @on-change="getEventId"
							style="width: 450px; margin-left: 10px">
							<Option v-for="item in eventNameList" :value="item.value" :key="item.label">
								{{ item.label }}
							</Option>
						</Select>
					</div>
					<div style="margin-bottom: 15px">
						<span style="font-size: 16px">产品类型：</span>
						<Select placeholder="请选择产品.." transfer clearable label-in-value v-model="productTypeValue"
							@on-change="getIamgeName" style="width: 450px; margin-left: 10px">
							<Option v-for="item in productTypeList" :value="item.value" :key="item.label">
								{{ item.label }}
							</Option>
						</Select>
					</div>
					<div style="margin-bottom: 15px" v-show="(isShowFbLine == '1' && isShowFbLineType == '1') ||
						(isShowFbLine == '2' && isShowFbLineType == '2')
						">
						<span style="font-size: 16px">发布方式：</span>
						<Select placeholder="请选择发布方式.." transfer clearable label-in-value v-model="selectDataTypeFb"
							@on-change="selectDataTypeChange" style="width: 450px; margin-left: 10px">
							<Option v-for="item in producesType" :value="item.value" :key="item.label">
								{{ item.label }}
							</Option>
						</Select>
					</div>
				</div>
				<div style="margin-bottom: 10px">
					<Table :columns="imageNameColumns" :data="imageNameList.slice(
						this.pageSelected * this.pageSize,
						(this.pageSelected + 1) * this.pageSize
					)
						" border stripe>
					</Table>
					<Page :total="imageNameList.length" :page-size="pageSize" show-total style="margin-left: 165px"
						@on-change="changePage"></Page>
				</div>
				<template #footer>
					<CButton @click="publishEvent" color="info" class="system-btn-style">发布</CButton>
					<CButton @click="publishCanncel" color="light">取消</CButton>
				</template>
			</Modal>
			<!-- shuju -->

			<Modal v-model="dataTreeShow1" draggable scrollable :transfer="true"
				style="z-index: 100000; position: absolute" title="选择数据" :width="700">
				<div style="height: 450px; width: 650px; overflow: scroll">
					<Tree :data="selectDataTree" :render="renderContent" :check-strictly="true" show-checkbox ref="tree"
						@on-check-change="selectTreeNodeInfo">
					</Tree>
				</div>
				<!-- <div class="resultDiv">
			<span style="text-align:center"
			>已选择的数据 {{ checkDataTotal }} 个</span>
			<Table
			border
			:columns="getRightColumn"
			:data="checkData"
			:width="350"
			>
			<template slot="operation" slot-scope="{ row, index }">
				<CButton
				v-c-tooltip="'删除'"
				title="删除"
				variant="outline"
				color="info"
				size="sm"
				@click="deletePathRow(row, index)"
				>
				<CIcon name="cil-x-circle" />
				</CButton>
			</template>
			</Table>
		</div> -->
				<template #footer>
					<div style="
			display: flex;
			justify-content: space-between;
			align-items: center;
			">
						<div>
							<input type="checkbox" checked style="margin-right: 8px" v-model="isTrue"
								@click="dataPart" />
							<span style="font-size: 18px; font-weight: 500">数据拆分</span>
						</div>
						<div>
							<Button @click="checkCancel" color="info" type="primary">取消勾选
							</Button>
							<Button @click="openTreeDataOk" type="primary" color="info" class="system-btn-style">确定
							</Button>
							<Button @click="openTreeDataCancel" color="light">取消</Button>
						</div>
					</div>
				</template>
			</Modal>
		</div>
	</Drawer>

	<Modal v-model="addFileLevelModal" draggable scrollable title="设置文件级别" class="addShow">
		<div style="margin: 20px">
			<div style="display: flex; margin-top: 20px">
				<span style="width: 90px">数据级别：</span>
				<Input v-model="uploadDataObj.fileLevel"></Input>
			</div>
			<div style="display: flex; margin-top: 20px" title="上传的文件将会保存在该文件夹下">
				<span style="width: 106px">转存路径：</span>
				<Input v-model="uploadDataObj.uploadfolderPath"></Input>
				<CButton @click="selectServerFolder" color="info" class="system-btn-style" style="
			width: 45px;
			height: 34px;
			margin-left: 10px;
			margin-top: -2px;
		">...</CButton>
			</div>
		</div>
		<template #footer>
			<CButton @click="addTreeData" color="info" class="system-btn-style">下一步</CButton>
			<CButton @click="addFileLevelModal = false" color="light">取消</CButton>
		</template>
	</Modal>

	<Modal v-model="fireSelectedModal" draggable scrollable>
		<p slot="header" class="modalHeader">
			<span>判读操作</span>
		</p>
		<div class="modalBody">
			<p>请确认是否保存判读结果</p>
			<p>是, 则保存数据；否,则取消操作</p>
		</div>
		<template #footer class="footerBtns">
			<CButton @click="fireInterpretationOk" color="info" class="system-btn-style">是</CButton>
			<CButton @click="fireInterpretationCancel" color="info" class="cancel-btn">否</CButton>
		</template>
	</Modal>

	<!-- 移除树节点 -->
	<Modal v-model="delShow" draggable scrollable title="删除树节点">
		<p slot="header" class="modalHeader">
			<img src="@/assets/icons/shanchu.svg" alt />
			<span>删除树叶子节点</span>
		</p>
		<div class="modalBody">
			<p>请确认是否选择叶子节点~</p>
			<p>确认是否删除?</p>
		</div>
		<template #footer class="footerBtns">
			<CButton @click="delShow = false" color="info" class="cancel-btn">取消</CButton>
			<CButton @click="delTreeDataOk" color="info" class="system-btn-style">确定</CButton>
		</template>
	</Modal>

	<!-- 恢复移除数据 -->
	<Modal v-model="recoverShow" scrollable draggable title="数据恢复" width="675px">
		<Table :columns="columns" :data="recoverData" border stripe @on-select="selectedData"
			@on-select-all="selectedData">
		</Table>
		<template #footer st>
			<CButton @click="recoverShow = false" color="info" class="cancel-btn">取消</CButton>
			<CButton @click="recoverDataOk" color="info" class="system-btn-style">确定</CButton>
		</template>
	</Modal>

	<!-- 元数据查看 -->
	<Modal style="display: flex" v-model="metadataViewShow" title="元数据查看" scrollable draggable width="900">
		<div style="display: flex">
			<div>
				<img :src="this.imgDetails.thumb" alt="缩略图" width="600" height="600" />
			</div>
			<div class="dataDetails">
				<span>影像详情</span>
				<table class="tableStyle">
					<tr>
						<td>卫星</td>
						<td>{{ this.dataMeta.SatelliteID }}</td>
					</tr>
					<tr>
						<td>传感器</td>
						<td>{{ this.dataMeta.SensorID }}</td>
					</tr>
					<tr>
						<td>采集时间</td>
						<td>{{ this.imgReceiveTime }}</td>
					</tr>
					<tr>
						<td>生产时间</td>
						<td>{{ this.dataMeta.ProductTime }}</td>
					</tr>
					<tr>
						<td>入库时间</td>
						<td>{{ this.dataMeta.EndTime }}</td>
					</tr>
					<tr>
						<td>云量</td>
						<td>{{ this.dataMeta.CloudPercent }}</td>
					</tr>
					<tr>
						<td>分辨率</td>
						<td>{{ this.dataMeta.ImageGSD }}</td>
					</tr>
					<tr>
						<td>轨道圈号</td>
						<td>{{ this.dataMeta.OrbitID }}</td>
					</tr>
					<tr>
						<td>景path/row</td>
						<td>
							{{ this.dataMeta.ScenePath }}/{{ this.dataMeta.SceneRow }}
						</td>
					</tr>
					<tr>
						<td>产品号</td>
						<td>{{ this.dataMeta.ProductID }}</td>
					</tr>
					<tr>
						<td>景号</td>
						<td>{{ this.dataMeta.SceneID }}</td>
					</tr>
					<tr>
						<td>左上角经/纬度</td>
						<td>
							[{{ this.dataMeta.TopLeftLongitude }},{{
								this.dataMeta.TopLeftLatitude
							}}]
						</td>
					</tr>
					<tr>
						<td>右上角经/纬度</td>
						<td>
							[{{ this.dataMeta.TopRightLongitude }},{{
								this.dataMeta.TopRightLatitude
							}}]
						</td>
					</tr>
					<tr>
						<td>右下角经/维度</td>
						<td>
							[{{ this.dataMeta.BottomRightLongitude }},{{
								this.dataMeta.BottomRightLatitude
							}}]
						</td>
					</tr>
					<tr>
						<td>左下角经/纬度</td>
						<td>
							[{{ this.dataMeta.BottomLeftLongitude }},{{
								this.dataMeta.BottomLeftLatitude
							}}]
						</td>
					</tr>
				</table>
			</div>
		</div>
	</Modal>

	<!-- 下载树节点 -->
	<!-- <Modal v-model="downShow" draggable scrollable footer-hide>
	<div id="downloadSetting">
	<label class="download-text">设置下载存储路径</label>
	<div class="download-content">
		<span>下载到：</span>
		<Input placeholder="D://12321321312" disabled></Input>
		<Button type="primary">浏览</Button>
	</div>
	<div class="btnGroup">
		<Button type="primary" @click="downloadTreeDataOk">下载</Button>
		<Button type="primary" @click="downShow = false">取消</Button>
	</div>
	</div>
</Modal> -->

	<!-- 火点判读 -->
	<Modal v-model="fireInterpretationShow" scrollable draggable footer-hide :transfer="false" title="火点判读"
		width="1000px" @on-visible-change="modelFireclose">
		<Table border :columns="getFireColumns" :data="fireData" @on-row-click="fireShow" style="margin: 25px 0"
			@on-select="selectedFireEvent" @on-selection-change="
				selectedFireDataChangeEvent($event, 'firelayer-high')
				">
			<template slot="status" slot-scope="{ row }">
				<Select v-model="row.status" transfer default-label="待判断" style="width: 100px"
					@click="getFire(row.status)" @on-change="fireSelectedChange($event, row)">
					<Option v-for="item in fireValue" :value="item.value" :key="item.label">
						{{ item.label }}
					</Option>
				</Select>
			</template>
		</Table>
	</Modal>
	<!-- shp颜色设置 -->
	<Modal v-model="shpColorShow" scrollable draggable title="颜色设置" width="450px">
		颜色选择：
		<ColorPicker v-model="shpColor" style="width: 280px; margin-left: 20px" recommend />
		<template #footer st>
			<CButton @click="shpColorShow = false" color="info" class="system-btn-style">取消</CButton>
			<CButton @click="shpColorOk" color="info" class="system-btn-style">确定</CButton>
		</template>
	</Modal>

	<!-- 样式设置 -->
	<Modal v-model="styleShow" draggable scrollable footer-hide title="样式设置" width="450px">
		<div class="styletree-style" style="border: solid 0.2px #f5f5f5">
			<div class="style-content">
				<span>透明度</span>
				<Slider class="style-slider" v-model="percent"></Slider>
			</div>

			<div class="style-content" style="margin-top: 10px">
				<span>拉伸方式</span>
				<Select style="width: 330px; margin-left: 20px" v-model="stretchStyle">
					<Option value="percentMinimumMaximum">百分比拉伸</Option>
					<Option value="histogramEqualize">直方图均衡化拉伸</Option>
					<Option value="minimumMaximum">最大最小值拉伸</Option>
					<Option value="standardDeviation">标准差拉伸</Option>
					<!-- <Option value="grammaStretch">伽马拉伸</Option> -->
				</Select>
			</div>

			<div class="style-choice">
				<div id="styleapply" style="width: 100px; font-size: 5px; border: solid 0.2px #f5f5f5">
					<Button type="primary" style="width: 70px; margin-top: 60px" @click="settingRgb">RGB合成</Button>
					<Button type="primary" style="width: 70px; margin-top: 40px" @click="settingStrecth">拉伸</Button>
				</div>
				<div v-show="rgbSettingShow" style="width: 350px; border: solid 0.1px #f5f5f5">
					<Table :columns="columnNames" :data="bandsData">
						<template slot-scope="{ row, index }" slot="band">
							<i-select transfer v-model="styleBands[index]">
								<i-option v-for="item in bandOptions" :value="item.value" :key="item.value">{{
									item.label }}
								</i-option>
							</i-select>
						</template>
					</Table>
				</div>
				<div v-show="strSettingShow" style="width: 350px; border: solid 0.1px #f5f5f5">
					<div style="margin-left: 20px; line-height: 28px">
						<span>波段：</span>

						<Select style="width: 252px" v-model="bandNumber">
							<Option v-for="item in bandOptions" :value="item.value" :key="item.value">{{ item.label }}
							</Option>
						</Select>
					</div>
					<div style="margin-left: 20px" class="colorbar_box">
						<span>颜色：</span>
						<input type="text" readonly="readonly" class="colorbar_ipt" v-model="bandColor"
							:style="{ background: inputStyle }" @click="openShow()" />
						<i :class="{ active: active }" class="el-icon-arrow-down"></i>

						<ul v-show="show">
							<li v-for="item in options" :key="item.value" :style="{ background: item.bgStyle }"
								@click="changeColor(item)"></li>
						</ul>
					</div>
				</div>
				<div v-show="colorSettingShow" style="width: 350px; border: solid 0.2px#A8A8A8"></div>
			</div>
		</div>
		<div class="stylebutton">
			<Button type="primary" style="width: 60px; margin-left: 80px" @click="deleteStyle">取消</Button>
			<Button type="primary" style="width: 60px; margin-left: 60px" @click="applicationTile">应用</Button>
			<Button type="primary" style="width: 80px; margin-left: 60px" @click="colorApplication">颜色应用</Button>
		</div>
	</Modal>
	<!-- shp选择目录 -->
	<CModal title="推送任务选择目录" color="info" :show.sync="showPushTaskZtreeModal" :closeOnBackdrop="false" size="lg"
		centered>
		<div class="treeDiv">
			<ul id="pushTaskTree" class="ztree"></ul>
		</div>

		<template #header>
			<h5>选择目录</h5>
			<CButtonClose @click="pushTaskMenuCancel" />
		</template>
		<template #footer>
			<CButton @click="pushTaskMenuOk" color="info" class="system-btn-style">确定</CButton>
			<CButton @click="pushTaskMenuCancel" color="light">取消</CButton>
		</template>
	</CModal>
	<!-- 卫星传感器选择 -->
	<CModal title="选择信息" color="info" :show.sync="showSelectAddInfoZtreeModal" :closeOnBackdrop="false" centered>
		<div class="treeDiv1">
			<ul id="selectInfoTree" class="ztree"></ul>
		</div>

		<template #header>
			<h5>选择</h5>
			<CButtonClose @click="selectAddInfoCancel" />
		</template>
		<template #footer>
			<CButton @click="selectAddInfoCancel" color="light">取消</CButton>
			<CButton @click="selectAddInfoOk" color="info">确定</CButton>
		</template>
	</CModal>

	<FileCatalog ref="refFileCatalogModal" v-if="fileCatalogModal" :modalShow="fileCatalogModal"
		@closed="fileCatalogModalClose" @menuOk="fileCatalogModalOk" @handleWorkflow="fileCatalogModalWorkflow">
	</FileCatalog>
	<!-- 基础地理数据加载 -->
	<FileCatalog ref="refBasicFileCatalogModal" v-if="fileCatalogModal" :modalShow="basicFileCatalogModal"
		@closed="fileBasicCatalogModalClose" @menuOk="fileBasicCatalogModalOk"></FileCatalog>

	<Modal v-model="dataManagementModal" draggable scrollable title="数管数据查询" width="1400px" class="dataManagementModal"
		@on-ok="dataManageModalOk" @on-cancel="dataManagementModalCancel">
		<DataManagementQuery ref="dataManagementMap" />
		<template #footer>
			<CButton @click="dataManagementModalCancel" color="light">取消</CButton>
			<CButton @click="dataManageModalOk" color="info" class="system-btn-style">添加数据</CButton>
			<CButton @click="submitTask" color="info" class="system-btn-style">提交任务</CButton>
		</template>
	</Modal>
	<!-- 删除树节点 -->
	<Modal v-model="deleteManagementModal" draggable scrollable title="删除数据" width="600px" height="700px"
		class="deleteManagementModal">
		<p slot="header" class="modalHeader">
			<img src="@/assets/icons/shanchu.svg" alt />
			<span>删除树节点</span>
		</p>
		<div class="modalBody">
			<p>是否从储存上删除数据</p>
			<p>请确认是否删除?</p>
		</div>

		<template #footer>
			<CButton @click="deleteManagementModal = false" color="light">取消</CButton>
			<CButton @click="deleteManageModalOk" color="info" class="system-btn-style">确定</CButton>
		</template>
	</Modal>
</div>
</template>
<script>
import axios from "axios";
import { Spin } from "iview";

import FileCatalog from "../../jobProcess/fileCatalog.vue";

import DataManagementQuery from "./datailDataManagementQuery.vue";
import wktToGeoJson from "../../../utils/WKTToGeoJson";

// import Legend from "../../views/Legend";
// import qs from "qs";
// import X2JS from "x2js";
export default {
	name: "detailLeftDrawer",
	props: {
		modelShow: {
			type: Boolean,
			default: false,
		},
		modelShow1: {
			type: Boolean,
			default: false,
		},
		map: {
			type: Object,
		},
		afterMap: {
			type: Object,
		},
		// img_L4: {
		//   type: Object,
		// },
		// shp_L5: {
		//   type: Object,
		// },
		// currentDrawGeometry1: {
		//   type: Array,
		//   default: [],
		// },
	},
	components: {
		FileCatalog,
		DataManagementQuery,
	},
	data() {
		return {
			layImgId: [],
			layShpId: [],
			fireGeojsonList: {
				type: "FeatureCollection",
				features: [],
			},
			fireGeojsonArr: [], //火点坐标用于地图操作
			currentFireRow: {}, //火点判读表格当前操作行数据
			fireSelectedModal: false, //确认是否保存判读结果
			selectedFireData: [],
			timeout: null,
			showTooltip: true,
			img_L4: {},
			shp_L5: {},

			selcetFilePath: [],
			selcetFilePath1: [],
			importantRegion: [], //重点区域
			importantRegionsList: [], //重点区域数据选择
			timer: "",
			dataManagementModal: false,
			addFileLevelModal: false,
			fileCatalogModal: false,
			basicFileCatalogModal: false,
			current: 0,

			uploadDataObj: {
				fileLevel: "L1A",
				uploadfolderPath: "/pie/data/wx01wxyg102/01/Risk",
			},

			customerArea: {},
			regionSelected: "", //按区域选择
			satelliteSelected: "", //按卫星选择
			regionList: [], //可选择的区域

			customerRegionList: [],
			currentDrawGeometryList: [], //地图绘制要素集合

			data1: [
				{
					name: "hello",
					age: 1,
				},
				{
					name: "world",
					age: 2,
				},
			],
			columns: [
				{
					type: "selection",
					width: 60,
					align: "center",
				},
				{
					title: "序号",
					type: "index",
					width: 80,
					align: "center",
				},
				{
					title: "所属区域",
					key: "region",
					width: 200,
				},
				{
					title: "数据名称",
					key: "name",
					width: 300,
				},
			],

			drawerShow: false,
			spatialShow: true, //设置
			dataTreeShow: false, //数据目录
			dataTreeShow1: false,
			checkDataTotal: 0,
			getRightColumn: [
				{
					key: "name",
					width: 230,
					title: "数据名称",
					align: "center",
				},
				{
					title: "操作",
					slot: "operation",
					align: "center",
				},
			],
			checkData: [],
			taskName: "", //事件名称
			taskTime: "", //事件
			TaskAddress: "", //地点
			TaskDisasterType: "", //灾种
			taskID: "", //任务id
			parentId: "",
			disasterTaskStatus: 0, //状态
			satellites: "", //卫星
			sensors: "", //传感器
			productLevel: "LEVEL1A", //产品级别
			taskAreaList: [], //区域结果
			drawingAreaList: [], //自定义绘制结果

			// regionBlock: true,

			shpPath: "",
			showPushTaskZtreeModal: false, //矢量文件show
			showSelectAddInfoZtreeModal: false, //卫星传感器show

			regionCascader: [], //级联选择区域
			regionResultList: [], //区域结果
			regionResultIDList: [],
			satelliteResultNameList: [],
			selectInfoList: [], //选择的信息
			productLevelList: ["LEVEL1A", "LEVEL2"],

			// 区域的变量
			currentRegionName: "",
			currentRegionList: [],
			currentregionType: 2,
			currentRegionCode: "",
			currentRegionInfo: {},
			currentSelectRegions: [],
			currentTreeNode: null, //右键选中数据
			imgDetails: {},
			treeNodeSelected: [], //树节点
			recoverData: [], //全部恢复数据
			allSelectData: [], //树结构中的所有数据
			recoverNodeList: [], //要恢复的
			addShow: false, //添加
			delShow: false, //移除
			nodes: [], //勾选叶子节点数据
			dataNote0: [],
			dataNote1: [],
			recoverShow: false, //数据恢复
			metadataViewShow: false, //元数据查看
			dataMeta: {}, //元数据xml元素
			imgReceiveTime: "", //元数据采集时间
			downShow: false, //下载
			styleShow: false, //样式
			//transparency: null, //透明度
			stretchStyle: "standardDeviation",
			rgbSettingShow: true, //Rgb设置
			strSettingShow: false, //拉伸设置
			colorSettingShow: false, //色彩映射设置

			//样式参数
			selectTileData: [],
			demColor: [],
			options: [
				{
					value: "1",
					label: "黑白",
					bgStyle: "linear-gradient(to right, #000000, #ffffff)",
				},
				{
					value: "2",
					label: "白黑",
					bgStyle: "linear-gradient(to right, #ffffff, #000000)",
				},
				{
					value: "3",
					label: "蓝色 浅蓝",
					bgStyle: "linear-gradient(to right, #0000ff, #00ffff)",
				},
				{
					value: "4",
					label: "浅蓝 紫色",
					bgStyle: "linear-gradient(to right, #00ffff, #ff00ff)",
				},
				{
					value: "5",
					label: "蓝色 浅蓝 紫色 白色",
					bgStyle:
						"linear-gradient(to right, #0000ff, #00ffff, #ff00ff, #ffffff)",
				},
				{
					value: "6",
					label: "白色 绿色",
					bgStyle: "linear-gradient(to right, #ffffff, #00ff00)",
				},
				{
					value: "7",
					label: "绿色 红色",
					bgStyle: "linear-gradient(to right, #00ff00, #ff0000)",
				},
				{
					value: "8",
					label: "红色 黄色",
					bgStyle: "linear-gradient(to right, #ff0000, #ffff00)",
				},
				{
					value: "9",
					label: "白色 绿色 红色 黄色",
					bgStyle:
						"linear-gradient(to right, #ffffff, #00ff00, #ff0000, #ffff00)",
				},
				{
					value: "10",
					label: "蓝色 紫色",
					bgStyle: "linear-gradient(to right, #0000ff, #ff00ff)",
				},
				{
					value: "11",
					label: "紫色 绿色",
					bgStyle: "linear-gradient(to right, #ff00ff, #00ff00)",
				},
				{
					value: "12",
					label: "绿色 黄色",
					bgStyle: "linear-gradient(to right, #00ff00, #ffff00)",
				},
				{
					value: "13",
					label: "蓝色 紫色 绿色 黄色",
					bgStyle:
						"linear-gradient(to right, #0000ff, #ff00ff, #00ff00, #ffff00)",
				},
				{
					value: "14",
					label: "黄色 浅蓝",
					bgStyle: "linear-gradient(to right, #ffff00, #00ffff)",
				},
				{
					value: "15",
					label: "浅蓝 白色",
					bgStyle: "linear-gradient(to right, #00ffff, #ffffff)",
				},
				{
					value: "16",
					label: "白色 红色",
					bgStyle: "linear-gradient(to right, #ffffff, #ff0000)",
				},
				{
					value: "17",
					label: "黄色 浅蓝 白色 红色",
					bgStyle:
						"linear-gradient(to right, #ffff00, #00ffff, #ffffff, #ff0000)",
				},
				{
					value: "18",
					label: "蓝色 绿色",
					bgStyle: "linear-gradient(to right, #0000ff, #00ff00)",
				},
				{
					value: "19",
					label: "绿色 浅蓝",
					bgStyle: "linear-gradient(to right, #00ff00, #00ffff)",
				},
				{
					value: "20",
					label: "浅蓝 红色",
					bgStyle: "linear-gradient(to right, #00ffff, #ff0000)",
				},
				{
					value: "21",
					label: "蓝色 绿色 浅蓝 红色",
					bgStyle:
						"linear-gradient(to right, #0000ff, #00ff00, #00ffff, #ff0000)",
				},
				{
					value: "22",
					label: "红色 紫色",
					bgStyle: "linear-gradient(to right, #ff0000, #ff00ff)",
				},
				{
					value: "23",
					label: "紫色 黄色",
					bgStyle: "linear-gradient(to right, #ff00ff, #ffff00)",
				},
				{
					value: "24",
					label: "黄色 白色",
					bgStyle: "linear-gradient(to right, #ffff00, #ffffff)",
				},
				{
					value: "25",
					label: "红色 紫色 黄色 白色",
					bgStyle:
						"linear-gradient(to right, #ff0000, #ff00ff, #ffff00, #ffffff)",
				},
				{
					value: "26",
					label: "蓝色 浅蓝 黄色 红色",
					bgStyle:
						"linear-gradient(to right, #0000ff, #00ff00, #ffff00, #ff0000)",
				},
				{
					value: "27",
					label: "27",
					bgStyle:
						"linear-gradient(to right, #9e0142, #d53e4f, #f46d43, #fdae61, #fee08b, #ffffbf, #e6f598, #abdda4,#66c2a5, #3288bd, #5e4fa2)",
				},
				{
					value: "28",
					label: "28",
					bgStyle:
						"linear-gradient(to right, #a50026, #d73027, #f46d43, #fdae61, #fee08b, #ffffbf, #d9ef8b, #a6d96a, #66bd63, #1a9850, #006837)",
				},
				{
					value: "29",
					label: "29",
					bgStyle:
						"linear-gradient(to right, #a50026, #d73027, #f46d43, #fdae61, #fee090, #ffffbf, #e0f3f8, #abd9e9, #74add1, #4575b4, #313695)",
				},
				{
					value: "30",
					label: "30",
					bgStyle:
						"linear-gradient(to right, #67001f, #b2182b, #d6604d, #f4a582, #fddbc7, #ffffff, #e0e0e0, #bababa, #878787, #4d4d4d, #1a1a1a)",
				},
				{
					value: "31",
					label: "31",
					bgStyle:
						"linear-gradient(to right, #67001f, #b2182b, #d6604d, #f4a582, #fddbc7, #f7f7f7, #d1e5f0, #92c5de, #4393c3, #2166ac, #053061)",
				},
				{
					value: "32",
					label: "32",
					bgStyle:
						"linear-gradient(to right, #7f3b08, #b35806, #e08214, #fdb863, #fee0b6, #f7f7f7, #d8daeb, #b2abd2, #8073ac, #542788, #2d004b)",
				},
				{
					value: "33",
					label: "33",
					bgStyle:
						"linear-gradient(to right, #40004b, #762a83, #9970ab, #c2a5cf, #e7d4e8, #f7f7f7, #d9f0d3, #a6dba0, #5aae61, #1b7837, #00441b)",
				},
				{
					value: "34",
					label: "34",
					bgStyle:
						"linear-gradient(to right, #8e0152, #c51b7d, #de77ae, #f1b6da, #fde0ef, #f7f7f7, #e6f5d0, #b8e186, #7fbc41, #4d9221, #276419)",
				},
				{
					value: "35",
					label: "35",
					bgStyle:
						"linear-gradient(to right, #543005, #8c510a, #bf812d, #dfc27d, #f6e8c3, #f5f5f5, #c7eae5, #80cdc1, #35978f, #01665e, #003c30)",
				},
			],
			//shp颜色设置
			shpColorShow: false,
			fireValue: [
				{ label: "伪火点", value: 0 },
				{ label: "真火点", value: 1 },
				{ label: "待判读", value: 2 },
			],
			fireInterpretationShow: false, //火点判读
			getFireColumns: [
				{
					type: "selection",
					width: 60,
					align: "center",
				},
				{
					title: "名称",
					key: "name",
					align: "center",
				},
				{
					title: "火点位置",
					key: "location",
					align: "center",
				},
				{
					title: "火点时间",
					key: "produceTime",
					align: "center",
				},
				{
					title: "影像",
					key: "productName",
					align: "center",
				},
				{
					title: "判读情况",
					align: "center",
					slot: "status",
				},
			],
			fireData: [],

			fireStatus: "",
			shpColor: "#088",
			shpData: {},
			//颜色选择
			inputStyle: "linear-gradient(to right, #000000, #ffffff)",
			percent: 20,
			bandOptions: [],
			styleBands: [],
			bandNumber: "", //波段个数
			bandColor: "",
			bandCount: -1,
			columnNames: [
				{
					title: "颜色通道",
					key: "channel",
					align: "center",
				},
				{
					title: "波段",
					key: "band",
					align: "center",
					slot: "band",
				},
			],
			//颜色通道
			bandsData: [
				{
					channel: "红色",
					band: "",
				},
				{
					channel: "绿色",
					band: "",
				},
				{
					channel: "蓝色",
					band: "",
				},
			],

			editIndex: -1,
			active: false,
			show: false,
			hhh: "",

			url: "",
			filePath: "",
			fileName: "",

			showPop: false,
			regionProviceCode: 22,
			disasterId: 1,

			dataList: [], //初始数据
			dataTreeList: [], //最终数据
			selectDataTree: [],
			// nodataList: "", //提示没有数据

			//切片发布参数
			lastSelected: [],
			lastX1: [],
			lastX2: [],
			lastShp: [],
			globalLineData: [], //所有的图框坐标
			layerID: "",
			//移除
			deleteManagementModal: false,
			productType: [],
			createTime: "",
			updateTime: "",
			delRegionName: "",
			delIndex: "",
			imgType: "", //右侧产品输入数据类型
			//保持样式参数
			styleLaterPercent: -1,
			styleLaterStretch: "",
			styleLaterBands: [],
			isTrue: false, //是否拆分数据
			showPublishBtn: false,
			publishShow: false,
			disasterList: [
				// { label: "地震", value: "EARTHQUAKE" },
				// { label: "地质灾害", value: "LANDSLIDE" },
				// { label: "洪涝", value: "FLOOD" },
				// { label: "火灾", value: "FIRE" },
				// { label: "安全生产", value: "SAFE_PRODUCTION" },
				// { label: "台风", value: "TYPHOON" },
				{ label: "干旱", value: "DROUGHT" },
				{ label: "冰凌", value: "ICE_CREAM" },
				// { label: "森林草原火灾", value: "FOREST_STEPPE_FIRE"},
				// { label: "其他", value: "OTHER" },
			],
			eventType: "",
			eventDate: "",
			eventTitle: "",
			eventArea: "",
			propsParams: {
				lazy: true, //可以理解为开关，什么时候结束
				lazyLoad: this.lazyLoad,
				checkStrictly: true,
				multiple: false
			},
			eventName: "",
			eventId: "",
			eventNameList: [],
			productTypeValue: "",
			productTypeList: [
				{ label: "灾前影像", value: "BEFORE" },
				{ label: "灾后影像", value: "AFTER" },
				// { label: "卫星应用产品图鉴", value: "TOPIC" },
				// { label: "解译输入影像", value: "ESTIMATE_INPUT" },
				// { label: "解译输出影像", value: "ESTIMATE_OUTPUT" },
				{ label: "卫星应用产品", value: "DISASTER_TOPIC" },
				{ label: "基础数据", value: "DISASTER_BASE" },
			],
			isShowFbLine: "3", //是否显示发布方式
			isShowFbLineType: "3",
			eventTypeResult: [],
			imageNameList: [],
			selectDataTypeFb: "",
			producesType: [],
			imageNameColumns: [
				{
					title: "序号",
					type: "index",
					width: 80,
					align: "center",
				},
				{
					title: "数据名称",
					key: "imageName",
					align: "center",
				},
			],
			imageNameList: [],
			pageSize: 3,
			pageSelected: 0,
			currentSelectData: [], //当前勾选的数据
			getPublishId: [],
			productionType: "",
		};
	},
	mounted() {
		this.disasterTaskStatus = this.$route.query.status;
		this.showPublishBtn = ['海冰冰凌', '干旱'].indexOf(this.$route.query.name) > -1;
		this.eventType = this.$route.query.name === '海冰冰凌' ? 'ICE_CREAM' : 'DROUGHT'
		// this.getDisasterInfoById();
		this.getRiskInfo(); //获取风险类型信息
		this.getCustomerRegionList(); //自定义绘制区域列表
		this.getRegionResult(); //获取区域结果列表数据
		this.foldLeft(); //左侧自由拖拽
		this.getSatelleData();
		this.getTreeDataList(); //获取数据目录树
		this.getImportantRegion(); //重点区域数据列表
		// this.getSatelleResult();
		this.getCityByProviceCode(); //获取省份
		// this.getRegionResult();
	},
	watch: {
		modelShow: {
			handler(val) {
				this.drawerShow = val;
			},
			deep: true,
			immediate: true,
		},
		modelShow1: {
			handler(val) {
				this.dataTreeShow1 = val;
			},
			deep: true,
			immediate: true,
		},
		img_L4: {
			handler(val) {
				this.img_L4 = val;
				console.log(this.img_L4, "vvkkkk");
			},
			deep: true,
			immediate: true,
		},
		shp_L5: {
			handler(val) {
				this.shp_L5 = val;
				console.log(this.shp_L5, "vvkkkk");
			},
			deep: true,
			immediate: true,
		},
	},
	methods: {
		async publishEvent() {
			if (!this.eventId || !this.productTypeValue) {
				this.$Message.info("请先选择事件名称和产品类型");
				return;
			}
			let images = [];
			for (let i = 0; i < this.getPublishId.length; i++) {
				let path = this.$api.emergencyMonitorApi.queryRiskDataWithId + this.getPublishId[i];
				await this.http.get(path).then((res) => {
					console.log(res);
					if (res.data.success) {
						images.push(res.data.data);
					}
				});
			}
			let path = this.$api.emergencyMonitorApi.publinshEvnet;
			let params = {
				eventId: this.eventId,
				eventName: this.eventName,
				images: images,
				taskId: this.taskID,
				type: this.productionType,
			};
			if (this.selectDataTypeFb) {
				if (this.selectDataTypeFb == "1") {
					params["isUrl"] = false;
				} else if (this.selectDataTypeFb == "2") {
					params["isUrl"] = true;
				} else {
					params["isUrl"] = false;
				}
			}
			console.log(params);
			this.http.post(path, params).then((res) => {
				this.$Message.info(res.data.message);
			});
			this.$emit("publish");
			this.publishShow = false;
			// this.eventType = "FOREST_STEPPE_FIRE";
			this.eventId = "";
			this.productTypeValue = "";
			this.imageNameList = [];
			this.eventDate = "";
			this.eventTitle = "";
			this.eventArea = "";
		},
		publishCanncel() {
			this.publishShow = false;
			// this.eventType = "FOREST_STEPPE_FIRE";
			this.eventId = "";
			this.productTypeValue = "";
			this.imageNameList = [];
			this.eventDate = "";
			this.eventTitle = "";
			this.eventArea = "";
		},
		changePage(index) {
			this.pageSelected = index - 1;
		},
		//修改发布方式
		selectDataTypeChange(value) {
			this.selectDataTypeFb = value.value;
		},
		getIamgeName(val) {
			console.log('val', val);
			this.productionType = val.label;
			console.log(this.productionType);
			if (val.value == "AFTER" || val.value == "BEFORE") {
				this.isShowFbLineType = "1";
			} else if (val.value == "DISASTER_TOPIC") {
				this.isShowFbLineType = "2";
			} else if (val.value == "RISK_DATA") {
				this.isShowFbLineType = this.isShowFbLine;
			} else {
				this.isShowFbLineType = "3";
			}
			let temp = [];
			console.log('eventTypeResult', this.eventTypeResult);
			for (let i = 0; i < this.eventTypeResult.length; i++) {
				if (this.eventTypeResult[i].images) {
					console.log(this.eventTypeResult[i].images);
					for (let j = 0; j < this.eventTypeResult[i].images.length; j++) {
						if (this.eventTypeResult[i].images[j].type === val.value) {
							temp.push(this.eventTypeResult[i].images[j]);
						}
					}
				}
			}
			this.imageNameList = [];
			temp.forEach((item, index) => {
				let obj = {
					index: index,
					imageName: item.imageName,
				};
				this.imageNameList.push(obj);
			});
			console.log(this.imageNameList);
		},
		getEventName(val) {
			// console.log('eventDate',this.$moment(this.eventDate).format("YYYY-MM-DD"))
			if (!this.eventType && val !== 'eventType') {
				this.$Message.info("灾害类型为必选项，请先选择灾害类型");
				return;
			}
			let params = {
				eventType: this.eventType,
				eventTitle: this.eventTitle,
				startDate: this.eventDate ? this.$moment(this.eventDate).format("YYYY-MM-DD") : "",
				endDate: this.eventDate ? this.$moment(this.eventDate).format("YYYY-MM-DD") : "",
				provinceId: this.eventArea[0] ? this.eventArea[0] + "0000" : "",
				cityId: this.eventArea[1] ? this.eventArea[1] + "00" : "",
				countyId: this.eventArea[2] ? this.eventArea[2] : "",
			}
			let path = this.$api.emergencyMonitorApi.getEventName;
			this.eventNameList = [];
			this.http.get(path, params).then((res) => {
				console.log('res.data', res.data);
				if (res.data.success) {
					let result = res.data.data;
					this.eventTypeResult = result;
					result.forEach((item) => {
						let obj = {
							label: item.eventTitle,
							value: item.disasterEventId,
						};
						if (!(item.eventTitle.indexOf('日-') > -1)) {
							obj.label = item.eventTime.split('-')[0] + '年' + item.eventTime.split('-')[1] + '月' + item.eventTime.split('-')[2] + '日' + item.eventTitle;
						}
						this.eventNameList.push(obj);
					});
				}
			});
		},
		getEventId(val) {
			let temp = this.eventNameList.find((item) => {
				return item.value === val;
			});
			this.eventId = temp.value;
			this.eventName = temp.label;
		},
		lazyLoad(node, resolve) {
			let self = this;
			if (!node) {
				return false;
			}
			const { level } = node;
			if (level === 0) {
				let path = this.$api.queryDealApi.regionQueryProvince;
				let param = {};
				self.http.get(path, param).then((res) => {
					resolve(
						res.data.data.map((val) => {
							return {
								value: val.code,
								label: val.name,
								leaf: val.code == 72,
							};
						})
					)
				})
			} else if (level === 1) {
				let path = this.$api.queryDealApi.regionQueryCityByProvince + node.value;
				self.http.get(path).then((res) => {
					resolve(
						res.data.data.map((val) => {
							return {
								value: val.code,
								label: val.name,
								leaf: val.code == 8101 || val.code == 8201,
							};
						})
					)
				})
			} else if (level === 2) {
				let path = this.$api.queryDealApi.regionQueryAreaByCityCode + node.value;
				self.http.get(path).then((res) => {
					resolve(
						res.data.data.map((val) => {
							return {
								value: val.code,
								label: val.name,
								leaf: true,
							};
						})
					)
				})
			}
		},
		publish() {
			// 勾选错误数据
			// 1.存在其他数据
			// 2.全是其他数据
			let exitArray = []; //存入数据
			let noExitArray = []; //存入数据
			this.productTypeValue = "";
			this.currentSelectData.map((item) => {
				console.log("当前勾选数据：", item);
				if (item.path) {
					if (item.path.indexOf("L5") != -1 || item.path.indexOf("L6") != -1) {
						exitArray.push(1);
					} else if (item.path.indexOf("L4") != -1) {
						exitArray.push(2);
					} else {
						console.log("...");
					}
					if (
						item.path.indexOf("L5") == -1 &&
						item.path.indexOf("L6") == -1 &&
						item.path.indexOf("L4") == -1
					) {
						noExitArray.push(item);
					}
				} else {
					this.$Message.info("不支持该级别数据的发布");
					return false;
				}
			});
			let noRepeatArray = [...new Set(exitArray)];
			console.log("去重后的数据：", noRepeatArray);
			if (this.currentSelectData.length != 0) {
				// 判断多种数据同时存在
				if (this.currentSelectData.length == exitArray.length) {
					if (exitArray.length != 1 && exitArray.length == noRepeatArray.length) {
						this.$Message.info("需要选择同类型数据发布");
						return false;
					}
				}
				// 判断多种数据同时不存在
				if (noExitArray.length > 0) {
					this.$Message.info("存在不支持发布的数据类型");
					return false;
				}
			} else {
				this.$Message.info("请勾选要发布的数据");
				return false;
			}
			// 勾选了正确数据：L4 L5 L6
			let pushArray = [];
			let L4Array = [];
			this.currentSelectData.map((item) => {
				console.log("当前勾选数据：", item);
				if (item.path) {
					if (item.path.indexOf("L5") != -1 || item.path.indexOf("L6") != -1) {
						console.log("存在5,6数据：", item);
						pushArray.push(item);
					}

					if (item.path.indexOf("L4") != -1) {
						console.log("存在4数据：", item);
						L4Array.push(item);
					}
				}
			});
			// 相同
			if (
				this.currentSelectData.length != 0 &&
				this.currentSelectData.length == pushArray.length
			) {
				console.log("当前勾选数据：", 1);
				this.isShowFbLine = "2";
				this.productTypeList = [{ label: "监测数据", value: "RISK_DATA" }];
				this.producesType = [
					{
						value: "1",
						label: "推送实体数据",
					}
				];
				// 如果只有一个方式，默认选中它
				this.selectDataTypeFb = '2';
			} else if (
				this.currentSelectData.length != 0 &&
				this.currentSelectData.length == L4Array.length
			) {
				console.log("当前勾选数据：", 2);
				this.isShowFbLine = "1";
				this.productTypeList = [
					{ label: "监测数据", value: "RISK_DATA" },
				];
				this.producesType = [
					{
						value: "2",
						label: "发布WMTS服务",
					},
				];
				// 如果只有一个方式，默认选中它
				this.selectDataTypeFb = '2';
			} else {
				console.log("当前勾选数据：", 3);
				this.producesType = [];
				this.isShowFbLine = "3";
				this.$Message.info("不支持该级别数据的发布");
				return false;
			}
			this.getEventName();
			this.publishShow = true;
		},
		selectedFireEvent(section, row) {
			let _this = this;
			_this.currentFireRow = row;
		},
		//窗口关闭事件
		modelFireclose(val) {
			if (val == true) return;
			this.removeLayer("firelayer-high");
			this.removeLayer("firelayer");
			this.map.flyTo({
				center: [116.4, 34.5],
				zoom: 3, // starting zoom
			});
		},
		//火点选择事件
		selectedFireDataChangeEvent(section, layerId) {
			//没有选中的数据 取消高亮

			if (section.length < 1) {
				this.map.setFilter(layerId, ["in", "id", ""]);
				this.map.flyTo({
					center: [116.4, 34.5],
					zoom: 3, // starting zoom
				});
				return;
			}
			//id 为feature的属性properties
			let arr = ["any"];
			section.forEach((item) => {
				arr.push(["==", ["get", "id"], item.id]);
			});

			this.map.setFilter(layerId, arr);
			let index = 0; //地图缩放点为当前选择行  全选则默认第一条数据
			for (let i = 0; i < section.length; i++) {
				if (section[i].id === this.currentFireRow.id) {
					index = i;
					break;
				}
			}
			this.map.flyTo({
				center: section[index].geoJson.coordinates,
				zoom: 10,
			});
			// var popup = new mapboxgl.Popup({
			//   closeButton: false,
			// });
			// popup
			//   .setLngLat(feature.geometry.coordinates)
			//   .setText(feature.properties.id)
			//   .addTo(map);
		},
		addFirePointLayer(id, data) {
			//将数据放于pointlayer显示
			this.map.addLayer({
				id: id,
				type: "circle",
				source: { type: "geojson", data: data },
				paint: {
					"circle-radius": 10,
					"circle-color": "green",
				},
			});
		},
		hightPointLayer(id, data, mapName) {
			// 高亮显示
			let tempIdLayer = id + "-high";
			let pointlayerhighlight = {
				id: tempIdLayer,
				type: "circle",
				source: {
					type: "geojson",
					data: data,
				},
				filter: ["in", "id", ""],
				paint: {
					"circle-radius": 10,
					"circle-color": "#B42222",
				},
			};
			if (!this.map.getLayer(tempIdLayer)) {
				this.map.addLayer(pointlayerhighlight);
			} else {
				this.map.getSource(tempIdLayer).setData(data);
			}
		},
		hightLineLayer(id, data, mapName) {
			// 高亮显示
			let tempIdLayer = id + "-high";
			let pointlayerhighlight = {
				id: tempIdLayer,
				type: "line",
				source: {
					type: "geojson",
					data: data,
				},
				filter: ["in", "id", ""],
				layout: {
					"line-cap": "round" /* 线条末端样式 */,
				},
				paint: {
					"line-color": "red",
					"line-width": 3,
				},
			};
			if (!this[mapName].getLayer(tempIdLayer)) {
				this[mapName].addLayer(pointlayerhighlight);
			} else {
				this[mapName].getSource(tempIdLayer).setData(data);
			}
		},
		fireSelectedChange(value, row) {
			row.status = value;
			this.currentFireRow = row;
			this.fireSelectedModal = true;
		},

		//获取风险类型信息
		getRiskInfo() {
			this.taskID = this.$route.query.id;
			this.parentId = this.$route.query.parentId;
			this.taskName = this.$route.query.name;
			this.$emit("taskName", this.taskName);
		},
		//重点区域
		getImportantRegion() {
			let path = this.$api.queryDealApi.disasterImportRegionQuery;
			this.http.get(path).then((res) => {
				if (res.data.code == 200) {
					let importantRegionList = res.data.data;
					// console.log(importantRegionList);
					for (let i = 0; i < importantRegionList.length; i++) {
						let importantRegion = importantRegionList[i];
						let tempData = {
							value: importantRegion.wkt,
							label: importantRegion.name,
							code: importantRegion.code,
							number: i,
						};
						this.importantRegionsList.push(tempData);
					}
				}
				console.log(this.importantRegionsList);
			});
		},
		importRegionShow(val) {
			console.log(val);
			let region = JSON.parse(val).features[0].geometry;
			// let wkt = await this.geoJsonToWkt(region);
			// console.log(wkt);
			// console.log(region);
			let geometry = {};
			if (region.type == "FeatureCollection") {
				geometry = region.features[0].geometry; //写的有问题 shpDataRegion为无效值
			} else if (region.type == "Feature") {
				geometry = region.geometry;
			} else if (region.type == "Polygon") {
				geometry = region;
			} else if (region.type === "MultiPolygon") {
				geometry = region;
			} else {
				geometry = region.geometries;
			}
			this.$emit("drawGeometry", geometry);
		},
		//加载到右侧地图
		loadToRightMap() {
			let _this = this;
			_this.loadShpAndImg(_this.currentTreeNode, "afterMap");
		},
		foldLeft() {
			this.asideWidth = this.asideWidth === 0 ? 300 : 0;
		},

		openTreeData(val) {
			this.dataTreeShow1 = true;
			this.imgType = val;
			let arr = this.dataList;
			console.log(arr, "arr");
			let Arr = [];
			let expand = true;
			let j = -1;
			let check = "";
			// 处理过程
			let imgpath = "";
			for (let i = 0; i < arr.length; i++) {
				// 先判断  Arr是否为空
				arr[i].produceTime = arr[i].produceTime
					? arr[i].produceTime.slice(0, 10)
					: "";
				if (Arr.length == 0) {
					imgpath = arr[i].path + "/" + arr[i].name;
					if (!arr[i].level.includes("L1")) {
						check = this.selcetFilePath.includes(imgpath) ? true : false;
						let param = {
							title: arr[i].produceTime,
							expand: true,
							contextmenu: true,
							children: [
								{
									title: arr[i].level,
									produceTime: arr[i].produceTime,
									expand: expand,
									contextmenu: true,
									children: [
										{
											title: arr[i].name,
											produceTime: arr[i].produceTime,
											level: arr[i].level,
											checked: check,
											id: arr[i].id,
											meta: arr[i].meta,
											path: arr[i].path,
											dataId: arr[i].dataId,
											region: arr[i].region,
											status: arr[i].status,
											tsakId: arr[i].taskId,
											thumb: arr[i].thumb,
											contextmenu: true,
											expand: expand,
										},
									],
								},
							],
						};
						// 判断节点的状态
						if (param.children[0].children[0].status == "normal") {
							Arr.push(param);
							j++;
						}
					}
				} else {
					//Arr 不为空
					imgpath = arr[i].path + "/" + arr[i].name;
					if (
						arr[i].produceTime == Arr[j].title &&
						!arr[i].level.includes("L1")
					) {
						//createTime相同
						let k = Arr[j].children.length - 1;
						if (arr[i].level != Arr[j].children[k].title) {
							check = this.selcetFilePath.includes(imgpath) ? true : false;
							//level不相同
							let param = {
								title: arr[i].level,
								produceTime: arr[i].produceTime,
								expand: true,
								contextmenu: true,
								children: [
									{
										title: arr[i].name,
										checked: check,
										produceTime: arr[i].produceTime,
										level: arr[i].level,
										id: arr[i].id,
										meta: arr[i].meta,
										path: arr[i].path,
										dataId: arr[i].dataId,
										region: arr[i].region,
										status: arr[i].status,
										tsakId: arr[i].taskId,
										thumb: arr[i].thumb,
										expand: expand,
										contextmenu: true,
									},
								],
							};
							// 判断节点的状态
							if (param.children[0].status == "normal") {
								Arr[j].children.push(param);
							}
						} else {
							//level相同
							check = this.selcetFilePath.includes(imgpath) ? true : false;
							let param = {
								title: arr[i].name,
								checked: check,
								produceTime: arr[i].produceTime,
								level: arr[i].level,
								expand: expand,
								id: arr[i].id,
								meta: arr[i].meta,
								path: arr[i].path,
								dataId: arr[i].dataId,
								region: arr[i].region,
								status: arr[i].status,
								tsakId: arr[i].taskId,
								thumb: arr[i].thumb,
								contextmenu: true,
							};
							// 判断节点的状态
							if (param.status == "normal") {
								Arr[j].children[k].children.push(param);
							}
						}
					} else {
						imgpath = arr[i].path + "/" + arr[i].name;
						if (!arr[i].level.includes("L1")) {
							//createTime不相同
							check = this.selcetFilePath.includes(imgpath) ? true : false;
							let param = {
								title: arr[i].produceTime,
								expand: true,
								contextmenu: true,
								children: [
									{
										title: arr[i].level,
										produceTime: arr[i].produceTime,
										expand: expand,
										contextmenu: true,
										children: [
											{
												title: arr[i].name,
												produceTime: arr[i].produceTime,
												level: arr[i].level,
												checked: check,
												id: arr[i].id,
												meta: arr[i].meta,
												path: arr[i].path,
												dataId: arr[i].dataId,
												region: arr[i].region,
												status: arr[i].status,
												tsakId: arr[i].taskId,
												thumb: arr[i].thumb,
												contextmenu: true,
												expand: expand,
											},
										],
									},
								],
							};
							if (param.children[0].children[0].status == "normal") {
								Arr.push(param);
								j++;
							}
						}
						// 判断节点的状态
					}
				}
			}
			this.selectDataTree = Arr;
			console.log(this.selectDataTree);
		},
		deletePathRow(item, index) {
			console.log(item, index);
			let _this = this;
			_this.checkData.splice(index, 1);
			_this.checkDataTotal = _this.checkData.length;
			// if(item.name.includes())
		},
		selectTreeNodeInfo(data) {
			console.log(data);
			let nodes = [];
			this.selcetFilePath1 = [];
			data.forEach((node) => {
				if (!node.children) {
					//添加输入数据路径
					let filePath = node.path + "/" + node.title;
					this.selcetFilePath1.push(filePath);
					nodes.push(node);
				}
			});
			console.log(this.selcetFilePath1);
		},
		// 拆分数据
		dataPart() {
			this.isTrue = !this.isTrue;
			console.log(this.isTrue);
			this.$emit("dataPart", this.isTrue);
		},
		checkCancel() {
			let arr = [];
			this.selectDataTree.forEach((item) => {
				item.children[0].children.forEach((ele) => {
					ele.checked = false;
				});
				arr.push(item);
			});
			this.selectDataTree = arr;
			console.log(this.selectDataTree);
		},
		openTreeDataOk() {
			// this.$emit("updateDir", this.selcetFilePath1);
			// console.log(this.selcetFilePath1)
			// console.log(this.selcetFilePath)
			let selcet =
				this.selcetFilePath1.length !== 0
					? this.selcetFilePath1
					: this.selcetFilePath;
			console.log(selcet);
			if (this.imgType == "imgDir") {
				this.$emit("updateDir", selcet);
			} else if (this.imgType == "imgNDVI") {
				this.$emit("updateNDVI", selcet);
			} else if (this.imgType == "imgLST") {
				this.$emit("updateLST", selcet);
			}
			this.selcetFilePath1 = [];
			this.isTrue = false;
			this.dataTreeShow1 = false;
		},
		openTreeDataCancel() {
			this.selcetFilePath1 = [];
			this.isTrue = false;
			this.dataTreeShow1 = false;
		},
		renderContent(h, { data }) {
			let texts = "";
			if (
				data.title !== null &&
				data.title !== undefined &&
				data.title !== ""
			) {
				texts = data.title;
			}
			return h(
				"div",
				{
					style: {
						display: "inline",
						width: "100%",
						cursor: "pointer",
					},
					on: {
						// 监听鼠标滚轮 防抖函数解决滚轮滚动出现tooltip闪烁
						// mousewheel: () => {
						//   // 不滚动时清除定时器 不显示tooltip
						//   clearTimeout(this.timeout);
						//   this.showTooltip = false;
						//   this.timeout = setTimeout(() => {
						//     this.showTooltip = true;
						//     //clearTimeout(this.timeout);
						//   }, 500);
						// },
						// 设置事件为被动 不会因为主线程影响到这个事件
						passive: true,
					},
				},
				this.showTooltip
					? [
						h(
							"Tooltip",
							{
								props: {
									placement: "top",
									transfer: true,
									maxWidth: 270,
								},
							},
							[
								texts,
								h(
									"span",
									{
										slot: "content",
										style: {
											whiteSpace: "normal",
										},
									},
									data.title
								),
							]
						),
					]
					: [
						h(
							"span",
							{
								slot: "content",
								style: {
									whiteSpace: "normal",
								},
							},
							data.title
						),
					]
			);
		},

		selectServerFolder() {
			let _this = this;
			this.serverFolder = true;
			this.fileCatalogModal = true; // 打开弹框
			this.$nextTick(() => {
				_this.$refs.refFileCatalogModal.initFileTree(
					{
						type: { name: "dir" },
					},
					false
				);
				_this.$refs.refFileCatalogModal.handleShow(true);
			});
		},
		drawGeometry(geojson, layerId) {
			let shpType = geojson.features[0].geometry.type;
			let self = this;
			self.map.addSource(layerId, {
				type: "geojson",
				data: geojson,
			});
			console.log(shpType, "shpType");
			if (shpType == "Point") {
				self.map.addLayer({
					id: layerId,
					type: "circle",
					source: layerId,
					layout: {},
					paint: {
						"circle-opacity": 0.8,
						"circle-radius": 6,
						"circle-color": "#B42222",
					},
				});
			} else if (shpType.includes("Line")) {
				self.map.addLayer({
					id: layerId,
					type: "line",
					source: layerId,
					// layout: {},
					layout: {
						"line-cap": "round",
					},
					paint: {
						"line-opacity": 0.8,
						"line-color": "#B42222",
						"line-width": 8,
					},
				});
			} else {
				console.log("mian");
				self.map.addLayer({
					id: layerId,
					type: "fill",
					source: layerId,
					layout: {},
					paint: {
						"fill-color": "#088",
						"fill-opacity": 0.8,
					},
				});
			}

			//this.showToCenter(geojson.features[0].geometry.coordinates);
		},
		drawGeometryFire(geojson, layerId) {
			let shpType = geojson.features[0].geometry.type;
			let self = this;
			self.map.addSource(layerId, {
				type: "geojson",
				data: geojson,
			});
			if (shpType == "Point") {
				self.map.addLayer({
					id: layerId,
					type: "circle",
					source: layerId,
					layout: {},
					paint: {
						"circle-opacity": 0.8,
						"circle-radius": 6,
						"circle-color": "#B42222",
					},
				});
			} else if (shpType.includes("Line")) {
				self.map.addLayer({
					id: layerId,
					type: "line",
					source: layerId,
					// layout: {},
					layout: {
						"line-cap": "round",
					},
					paint: {
						"line-opacity": 0.8,
						"line-color": "#B42222",
						"line-width": 8,
					},
				});
			} else {
				console.log("mian");
				self.map.addLayer({
					id: layerId,
					type: "fill",
					source: layerId,
					layout: {},
					paint: {
						"fill-color": "#088",
						"fill-opacity": 0.8,
					},
				});
			}

			//this.showToCenter(geojson.features[0].geometry.coordinates);
		},

		drawGeometryColor(geojson, layerId, shpColor) {
			let self = this;
			let shpType = geojson.features[0].geometry.type;
			self.map.addSource(layerId, {
				type: "geojson",
				data: geojson,
			});

			if (shpType == "Point") {
				self.map.addLayer({
					id: layerId,
					type: "circle",
					source: layerId,
					layout: {},
					paint: {
						"circle-opacity": 0.5,
						"circle-radius": 6,
						"circle-color": shpColor,
					},
				});
			} else if (shpType == "MultiLineString") {
				self.map.addLayer({
					id: layerId,
					type: "line",
					source: layerId,
					layout: {
						"line-cap": "round",
					},
					paint: {
						"line-opacity": 0.5,
						"line-color": shpColor,
						"line-width": 8,
					},
				});
			} else {
				self.map.addLayer({
					id: layerId,
					type: "fill",
					source: layerId,
					layout: {},
					paint: {
						"fill-color": shpColor,
						"fill-opacity": 0.5,
					},
				});
			}
			//  this.showToCenter(geojson.features[0].geometry.coordinates);
		},

		getRegionByShp(shpPath, isShow) {
			console.log(shpPath, isShow);
			let layerId = shpPath.id + "";
			console.log(layerId, "shplayer");
			if (!isShow) {
				this.removeLayer(layerId);
				return;
			}
			let path = this.$api.riskMonitorApi.addShpFileQuery;
			let param = {
				fileName: shpPath.path + "/" + shpPath.title,
			};

			this.http.post(path, param).then((res) => {
				if (res.data.code == 200) {
					let shpDataRegion = res.data.data;
					console.log(shpDataRegion, "shpDataRegion");

					this.drawGeometry(shpDataRegion, layerId);
				} else {
					this.$Message.info("读取shp文件出错");
				}
				// 绘制区域
				//this.$emit("drawGeometry", shpDataRegion.features[0]);
			});
		},
		getRegionByShpFire(shpPath, isShow) {
			console.log(shpPath, isShow);
			let layerId = "shpId";

			if (!isShow) {
				this.removeLayer(layerId);
				return;
			}
			let path = this.$api.riskMonitorApi.addShpFileQuery;
			let param = {
				fileName: shpPath.path + "/" + shpPath.title,
			};

			this.http.post(path, param).then((res) => {
				if (res.data.code == 200) {
					let shpDataRegion = res.data.data;
					this.drawGeometryFire(shpDataRegion, layerId);
				} else {
					this.$Message.info("读取shp文件出错");
				}
				// 绘制区域
				//this.$emit("drawGeometry", shpDataRegion.features[0]);
			});
		},
		getRegionByShpColor(shpPath) {
			console.log(shpPath);
			let layerId = shpPath.id + "";
			if (this.map.getLayer(layerId)) {
				this.removeLayer(layerId);
			}
			let path = this.$api.riskMonitorApi.addShpFileQuery;
			let param = {
				fileName: shpPath.path + "/" + shpPath.name,
			};

			this.http.post(path, param).then((res) => {
				if (res.data.code == 200) {
					let shpDataRegion = res.data.data;
					let shpColor = this.shpColor;
					this.drawGeometryColor(shpDataRegion, layerId, shpColor);
				}
				this.shpColor = "";
			});
		},

		dataManageModalOk() {
			let _this = this;
			let data = this.$refs.dataManagementMap.getQueryData();
			console.log(data);
			this.dataManagementModal = false;
			let path = this.$api.riskMonitorApi.addAssociateDataBySG + this.taskID;

			let param = {
				images: data.data,
				level: data.level.substring(4, 6),
				path: "/pie/data/wx01wxyg102/01/Risk",
				// + "/" + this.taskName,
			};
			_this.loading('正在上传数据，请稍后哦~"');
			this.http.post(path, param).then((res) => {
				Spin.hide();
				if (res.data.success) {
					this.$Message.info("保存数据成功，立即刷新目录树");
					this.getTreeDataList();
				} else {
					this.$Message.error(res.data.message);
				}
			});
			this.$refs.dataManagementMap.reset();
		},
		dataManagementModalCancel() {
			this.$refs.dataManagementMap.reset();
			this.dataManagementModal = false;
		},
		//提交任务
		submitTask() {
			this.$refs.dataManagementMap.handleTask();
			this.dataManagementModal = false;
		},
		deleteManageModalOk() {
			let arr = [];
			let i = 0;

			while (i < this.nodes.length) {
				if (this.nodes[i].id) {
					arr.push(this.nodes[i].id);
				}
				i++;
			}
			console.log(arr);
			// let arr = this.nodes;
			// for (let i = 0; i < arr.length; i++) {
			//   let id = arr[i].id;
			//   let temp = {
			//     id: id,
			//   };

			let path = this.$api.riskMonitorApi.deleteAssociateDataBatch;
			this.http.post(path, arr).then((res) => {
				if (res.data.success) {
					this.getTreeDataList();
					this.$Message.info("删除数据成功，请刷新目录树~");
					this.deleteManagementModal = false;
				} else {
					this.$Message.error(res.data.message);
					this.deleteManagementModal = false;
				}
			});
			// }
		},
		// 移除
		deleteTreeData() {
			this.delShow = true;
		},
		//确定移除
		delTreeDataOk() {
			this.delShow = false;
			let arr = []; //记录移除节点的id
			let i = 0;
			console.log(this.nodes, "nodes");
			while (i < this.nodes.length) {
				if (this.nodes[i].id) {
					arr.push(this.nodes[i].id);
				}
				i++;
			}
			let nodes = this.nodes;
			let path = this.$api.taskManageApi.riskUpdateTreeBatch;
			// let flag = 0;
			let param = [];
			for (let i = 0; i < arr.length; i++) {
				let temp = {
					id: arr[i],
					status: "delete",
				};
				param.push(temp);
			}
			console.log(param, "param");
			this.http.post(path, param).then((res) => {
				if (res.data.code == 200) {
					// flag++;
					this.$Message.info("移除成功，即将刷新目录树！");
					this.getTreeDataList();
				} else {
					this.$Message.error(res.data.message);
				}
			});

			// if (flag == arr.length) {
			//   this.$Message.success("移除成功！");
			// } else if (flag == 0) {
			//   this.$Message.error("移除失败！");
			// } else {
			//   this.$Message.error("部分移除失败！");
			// }
		},
		basicGeographicData() {
			this.fileCatalogModal = true;
			this.basicFileCatalogModal = true;
			this.$nextTick(() => {
				this.$refs.refBasicFileCatalogModal.initFileTree(
					{
						type: { name: "file" },
						constraint: { extensions: "*.zip,*.tar.gz,*.shp," },
					},
					false
				);
			});
		},
		fileBasicCatalogModalClose() {
			this.fileCatalogModal = false;
		},
		fileBasicCatalogModalOk(path) {
			let path1 = this.$api.taskManageApi.addBasicGeoData + this.taskID;
			let param = {
				filePath: path,
			};
			this.http.get(path1, param).then((res) => {
				if (res.data.success) {
					this.dataList.push(res.data.data);
					this.getDataTreeList();
					// this.getTreeDataList()
					this.fileCatalogModal = false;
					this.getDataTreeList();
				} else {
					this.$Message.error(res.data.message);
					this.fileCatalogModal = false;
				}
			});
		},
		delBasicGeographic() {
			console.log(this.currentTreeNode);
			let path =
				this.$api.taskManageApi.delBasicGeographic + this.currentTreeNode.id;
			this.http.delete(path).then((res) => {
				if (res.data.success) {
					this.$Message.info(res.data.message);
					// this.getDataTreeList();
					this.getTreeDataList();
				}
			});
		},
		fixBasicScaleMapShp() {
			console.log(this.currentTreeNode);
			let region = this.currentTreeNode.region;
			let regionwkt = wktToGeoJson(region);
			console.log(regionwkt);
			let geometry = {};
			if (regionwkt.type == "FeatureCollection") {
				geometry = shpDataRegion.features[0]; //写的有问题 shpDataRegion为无效值
			} else if (regionwkt.type == "Feature") {
				geometry = regionwkt.geometry;
			} else if (regionwkt.type == "Polygon") {
				geometry = regionwkt;
			} else if (regionwkt.type === "MultiPolygon") {
				geometry = regionwkt;
			} else {
				geometry = regionwkt;
			}
			this.$emit("drawGeometry", geometry);
		},
		algoDropdownMenuChange(val) {
			let _this = this;
			if (val === "local") {
				this.addFileLevelModal = true;
				this.uploadDataObj.uploadfolderPath =
					this.uploadDataObj.uploadfolderPath;
				// + "/" + this.taskName;
			} else if (val === "dataManagement") {
				this.dataManagementModal = true;
				// this.gettestMap();
				clearTimeout(this.timer);
				this.timer = setTimeout(() => {
					this.$refs.dataManagementMap.resizeMap();
					// let areas = _this.getSearchRegion();
					// this.$refs.dataManagementMap.setcurrentRegionInfo(areas);
				}, 200);
			}
		},
		deleteMenuData(val) {
			let _this = this;
			if (val === "local") {
				this.delShow = true;
			} else if (val === "dataManagement") {
				this.deleteManagementModal = true;
			}
		},

		fileCatalogModalWorkflow(path) {
			this.fileCatalogModal = false;
			let temp = path.split("#TASK#");
			console.log(temp);
			if (temp.length > 3)
				this.$Message.info("当前选择大于3个文件,系统会自动处理前三个文件");
			let imagePath = path.split("#TASK#").slice(0, 3);
			let path1 = this.$api.riskMonitorApi.localWorkflow + this.taskID;
			let param = {
				images: imagePath,
				path: this.uploadDataObj.uploadfolderPath,
			};
			console.log(param);
			this.http.post(path1, param).then((res) => {
				if (res.data.success) {
					this.$Message.info("正在执行，请稍后~");
				} else {
					this.$Message.error(res.data.message);
				}
			});
		},
		fileCatalogModalOk(path) {
			console.log(path);
			this.fileCatalogModal = false;
			console.log(this.serverFolder);
			if (this.serverFolder) {
				this.uploadDataObj.uploadfolderPath = path;
				this.serverFolder = false;
				return;
			}
			let temp = path.split("#TASK#");
			console.log(temp);
			if (temp.length > 3)
				this.$Message.info("当前选择大于3个文件,系统会自动处理前三个文件");
			this.selectFilePath = path.split("#TASK#").slice(0, 3);

			this.submitLocalFile();
		},
		fileCatalogModalClose() {
			this.fileCatalogModal = false;
			this.serverFolder = false;
		},
		//加载图层
		loading(text) {
			if (!text) text = "加载中，请稍后...";
			Spin.show({
				render: (h) => {
					return h("div", [
						h("Icon", {
							class: "spin-icon-load",
							props: {
								type: "ios-loading",
								size: 30,
							},
						}),
						h("div", text),
					]);
				},
			});
		},
		submitLocalFile() {
			let _this = this;
			let path = this.$api.riskMonitorApi.addAssociateDataByLocal + this.taskID;
			let param = {
				images: this.selectFilePath,
				level: this.uploadDataObj.fileLevel,
				path: this.uploadDataObj.uploadfolderPath,
			};
			console.log(param);
			_this.loading('正在上传数据，请稍后哦~"');
			this.http.post(path, param).then((res) => {
				Spin.hide();
				if (res.data.success) {
					this.$Message.info("上传成功~");
					//刷新目录树
					this.getTreeDataList();
				} else {
					this.$Message.error(res.data.message);
				}
			});
		},

		handleEdit(row, index) {
			this.channel = row.channel;
			this.editIndex = index;
		},
		customerAreaChange(item) {
			this.customerArea = item;
		},

		// @on-open-change="regionSelectedChange1"
		// regionSelectedChange1(item) {
		//   if (item) return;
		//   if (this.satelliteSelected.length !== 0) {
		//     this.refreshTreeDataByReion();
		//     this.refreshTreeDataBySatellite();
		//   } else {
		//     this.refreshTreeDataByReion();
		//   }
		// },
		// 根据区域选择刷新目录树F
		// refreshTreeDataByReion() {
		//   let path = this.$api.taskManageApi.getTreeDataList;
		//   let params = {
		//     taskId: this.taskID,
		//     parentId: this.parentId,
		//     region: this.regionSelected.join("#"),
		//   };
		//   this.loading("正在请求目录树，请稍后哦~");
		//   this.http.get(path, params).then((res) => {
		//     Spin.hide();
		//     if (res.data.code == 200) {
		//       this.dataList = res.data.data;

		//       this.getDataTreeList();
		//     } else {
		//       this.nodataList = res.data.message;
		//     }
		//   });
		// },
		// @on-open-change="satelliteSelectedChange1"
		// satelliteSelectedChange1(item) {
		//   //判断item与satelliteSelected是否有值
		//   // console.log(item, this.satelliteSelected.length);
		//   if (item || this.satelliteSelected.length == 0)
		//     return this.getDataTreeList();
		//   this.refreshTreeDataBySatellite();
		// },
		//根据卫星选择目录树
		// refreshTreeDataBySatellite() {
		//   let path = this.$api.taskManageApi.getTreeDataList;
		//   let params = {
		//     taskId: this.taskID,
		//     parentId: this.parentId,
		//     // region: this.regionSelected.join("#"),
		//   };
		//   this.loading("正在请求目录树，请稍后哦~");
		//   this.http.get(path, params).then((res) => {
		//     Spin.hide();
		//     if (res.data.code == 200) {
		//       this.dataList = res.data.data;
		//       // console.log()
		//       this.getSatalliteTreeList();
		//     } else {
		//       this.nodataList = res.data.message;
		//     }
		//   });
		// },
		// //根据卫星种类来渲染目录树
		// getSatalliteTreeList() {
		//   let arr = this.dataList;
		//   // console.log(arr)

		//   let Crr = [];
		//   let expand = true;
		//   let j = -1;
		//   // 处理过程
		//   for (let i = 0; i < arr.length; i++) {

		//     if (arr[i].level) {
		//       // 先判断  Arr是否为空
		//       arr[i].produceTime = arr[i].produceTime
		//         ? arr[i].produceTime.slice(0, 10)
		//         : "";

		//       if (Crr.length == 0) {
		//         if (!arr[i].level || arr[i].level.includes("L1")) {
		//           expand = false;
		//         }
		//         let param = {
		//           title: arr[i].produceTime,
		//           expand: true,
		//           contextmenu: true,
		//           children: [
		//             {
		//               title: arr[i].level,
		//               produceTime: arr[i].produceTime,
		//               expand: expand,
		//               contextmenu: true,
		//               children: [
		//                 {
		//                   title: arr[i].name,
		//                   produceTime: arr[i].produceTime,
		//                   level: arr[i].level,
		//                   id: arr[i].id,
		//                   meta: arr[i].meta,
		//                   path: arr[i].path,
		//                   dataId: arr[i].dataId,
		//                   region: arr[i].region,
		//                   status: arr[i].status,
		//                   tsakId: arr[i].taskId,
		//                   thumb: arr[i].thumb,
		//                   contextmenu: true,
		//                   expand: expand,
		//                 },
		//               ],
		//             },
		//           ],
		//         };
		//         // console.log(param,'--------------------');
		//         // console.log(this.satelliteSelected);
		//         console.log(param.children[0].children[0].title.split('_')[0].split("-")[0]);
		//         // 判断节点的状态
		//         if (
		//           param.children[0].children[0].status == "normal" &&
		//           this.satelliteSelected.includes(
		//             param.children[0].children[0].title.split("_")[0].split("-")[0]
		//           )
		//         ) {
		//           Crr.push(param);
		//           console.log(Crr, "不为空");
		//           j++;
		//         }
		//       } else {
		//         //Crr 不为空
		//         if (arr[i].produceTime == Crr[j].title) {
		//           //createTime相同
		//           let k = Crr[j].children.length - 1;
		//           if (arr[i].level != Crr[j].children[k].title) {
		//             if (!arr[i].level || arr[i].level.includes("L1")) {
		//               expand = false;
		//             }
		//             //level不相同
		//             let param = {
		//               title: arr[i].level,
		//               produceTime: arr[i].produceTime,
		//               expand: true,
		//               contextmenu: true,
		//               children: [
		//                 {
		//                   title: arr[i].name,
		//                   produceTime: arr[i].produceTime,
		//                   level: arr[i].level,
		//                   id: arr[i].id,
		//                   meta: arr[i].meta,
		//                   path: arr[i].path,
		//                   dataId: arr[i].dataId,
		//                   region: arr[i].region,
		//                   status: arr[i].status,
		//                   tsakId: arr[i].taskId,
		//                   thumb: arr[i].thumb,
		//                   expand: expand,
		//                   contextmenu: true,
		//                 },
		//               ],
		//             };
		//             // 判断节点的状态
		//             if (
		//               param.children[0].status == "normal" &&
		//               this.satelliteSelected.includes(
		//                 param.children[0].title.split("_")[0].split("-")[0]
		//               )
		//             ) {
		//               Crr[j].children.push(param);
		//             }
		//           } else {
		//             if (!arr[i].level || arr[i].level.includes("L1")) {
		//               expand = false;
		//             }

		//             let param = {
		//               title: arr[i].name,
		//               produceTime: arr[i].produceTime,
		//               level: arr[i].level,
		//               expand: expand,
		//               id: arr[i].id,
		//               meta: arr[i].meta,
		//               path: arr[i].path,
		//               dataId: arr[i].dataId,
		//               region: arr[i].region,
		//               status: arr[i].status,
		//               tsakId: arr[i].taskId,
		//               thumb: arr[i].thumb,
		//               contextmenu: true,
		//             };
		//             // 判断节点的状态
		//             if (
		//               param.status == "normal" &&
		//               this.satelliteSelected.includes(
		//                 param.title.split("_")[0].split("-")[0]
		//               )
		//             ) {
		//               Crr[j].children[k].children.push(param);
		//             }
		//           }
		//         } else {
		//           if (!arr[i].level || arr[i].level.includes("L1")) expand = false;

		//           //createTime不相同
		//           let param = {
		//             title: arr[i].produceTime,
		//             expand: true,
		//             contextmenu: true,
		//             children: [
		//               {
		//                 title: arr[i].level,
		//                 produceTime: arr[i].produceTime,
		//                 expand: expand,
		//                 contextmenu: true,
		//                 children: [
		//                   {
		//                     title: arr[i].name,
		//                     produceTime: arr[i].produceTime,
		//                     level: arr[i].level,
		//                     id: arr[i].id,
		//                     meta: arr[i].meta,
		//                     path: arr[i].path,
		//                     dataId: arr[i].dataId,
		//                     region: arr[i].region,
		//                     status: arr[i].status,
		//                     tsakId: arr[i].taskId,
		//                     thumb: arr[i].thumb,
		//                     contextmenu: true,
		//                     expand: expand,
		//                   },
		//                 ],
		//               },
		//             ],
		//           };
		//           // 判断节点的状态
		//           if (
		//             param.children[0].children[0].status == "normal" &&
		//             this.satelliteSelected.includes(
		//               param.children[0].children[0].title
		//                 .split("_")[0]
		//                 .split("-")[0]
		//             )
		//           ) {
		//             Crr.push(param);
		//             j++;
		//           }
		//         }
		//       }
		//     } else {
		//       let param = {
		//         title: arr[i].name,
		//         id: arr[i].id,
		//         taskId: arr[i].taskId,
		//         region: arr[i].region,
		//         expande: false,
		//         contextmenu: true,
		//         status: "normal",
		//       };
		//       if (arr[i].status == "normal") {
		//         Crr.push(param);
		//         j++;
		//       }
		//     }
		//   }
		//   // console.log(Arr)
		//   return (this.dataTreeList = Crr);
		//   // console.log(this.dataTreeList,"this.dataTreeList----weixing")
		// },
		// 按关键字搜索
		keySearch(val) {
			console.log(val);
			let path = this.$api.riskMonitorApi.getSearchResult;
			let params = {
				taskId: this.taskID,
				parentId: this.parentId,
				fileName: val,
				region: this.regionSelected,
				dataType: this.satelliteSelected,
			};
			console.log(params);
			this.loading("正在请求目录树，请稍后哦~");
			this.http.get(path, params).then((res) => {
				Spin.hide();
				if (res.data.code == 200) {
					this.dataList = res.data.data;
					this.getDataTreeList();
				} else {
					this.dataTreeList = [];
					this.$Message.error(res.data.message);
				}
			});
		},

		getSatalliteTreeList1(img_L4, shp_L5) {
			let arr = this.dataList;
			let Arr = [];
			let expand = true;
			let j = -1;
			// 处理过程
			let check = false;
			for (let i = 0; i < arr.length; i++) {
				if (arr[i].level) {
					// 先判断  Arr是否为空
					arr[i].produceTime = arr[i].produceTime
						? arr[i].produceTime.slice(0, 10)
						: "";
					if (Arr.length == 0) {
						if (!arr[i].level || arr[i].level.includes("L1")) {
							expand = false;
						}
						for (let p = 0; p < img_L4.length; p++) {
							let code =
								img_L4[p].name.split("_")[img_L4[p].name.split("_").length - 1];
							if (arr[i].level.includes("L4") && arr[i].name.includes(code)) {
								check = true;
							} else if (
								arr[i].level.includes("L5") &&
								arr[i].name.includes(shp_L5.name)
							) {
								check = true;
							} else {
								check = false;
							}
						}

						let param = {
							title: arr[i].produceTime,
							expand: true,
							contextmenu: true,
							checked: check,
							children: [
								{
									title: arr[i].level,
									produceTime: arr[i].produceTime,
									expand: expand,
									contextmenu: true,
									checked: check,
									children: [
										{
											title: arr[i].name,
											produceTime: arr[i].produceTime,
											level: arr[i].level,
											id: arr[i].id,
											meta: arr[i].meta,
											path: arr[i].path,
											checked: check,
											dataId: arr[i].dataId,
											region: arr[i].region,
											status: arr[i].status,
											tsakId: arr[i].taskId,
											thumb: arr[i].thumb,
											contextmenu: true,
											expand: expand,
										},
									],
								},
							],
						};
						// 判断节点的状态
						if (param.children[0].children[0].status == "normal") {
							console.log(param, "param");
							Arr.push(param);
							console.log(Arr, "不为空");
							j++;
						}
					} else {
						//Arr 不为空
						if (arr[i].produceTime == Arr[j].title) {
							//createTime相同
							let k = Arr[j].children.length - 1;
							if (arr[i].level != Arr[j].children[k].title) {
								if (!arr[i].level || arr[i].level.includes("L1")) {
									expand = false;
								}
								for (let p = 0; p < img_L4.length; p++) {
									let code =
										img_L4[p].name.split("_")[
										img_L4[p].name.split("_").length - 1
										];
									if (
										arr[i].level.includes("L4") &&
										arr[i].name.includes(code)
									) {
										check = true;
									} else if (
										arr[i].level.includes("L5") &&
										arr[i].name.includes(shp_L5.name)
									) {
										check = true;
									} else {
										check = false;
									}
								}
								//level不相同
								let param = {
									title: arr[i].level,
									produceTime: arr[i].produceTime,
									expand: true,
									checked: check,
									contextmenu: true,
									children: [
										{
											title: arr[i].name,
											produceTime: arr[i].produceTime,
											level: arr[i].level,
											id: arr[i].id,
											checked: check,
											meta: arr[i].meta,
											path: arr[i].path,
											dataId: arr[i].dataId,
											region: arr[i].region,
											status: arr[i].status,
											tsakId: arr[i].taskId,
											thumb: arr[i].thumb,
											expand: expand,
											contextmenu: true,
										},
									],
								};
								// 判断节点的状态
								if (param.children[0].status == "normal") {
									Arr[j].children.push(param);
								}
							} else {
								if (!arr[i].level || arr[i].level.includes("L1")) {
									expand = false;
								}
								for (let p = 0; p < img_L4.length; p++) {
									let code =
										img_L4[p].name.split("_")[
										img_L4[p].name.split("_").length - 1
										];
									if (
										arr[i].level.includes("L4") &&
										arr[i].name.includes(code)
									) {
										check = true;
									} else if (
										arr[i].level.includes("L5") &&
										arr[i].name.includes(shp_L5.name)
									) {
										check = true;
									} else {
										check = false;
									}
								}

								let param = {
									title: arr[i].name,
									produceTime: arr[i].produceTime,
									level: arr[i].level,
									expand: expand,
									checked: check,
									id: arr[i].id,
									meta: arr[i].meta,
									path: arr[i].path,
									dataId: arr[i].dataId,
									region: arr[i].region,
									status: arr[i].status,
									tsakId: arr[i].taskId,
									thumb: arr[i].thumb,
									contextmenu: true,
								};
								// 判断节点的状态
								if (param.status == "normal") {
									Arr[j].children[k].children.push(param);
								}
							}
						} else {
							if (!arr[i].level || arr[i].level.includes("L1")) expand = false;
							for (let p = 0; p < img_L4.length; p++) {
								let code =
									img_L4[p].name.split("_")[
									img_L4[p].name.split("_").length - 1
									];
								if (arr[i].level.includes("L4") && arr[i].name.includes(code)) {
									check = true;
								} else if (
									arr[i].level.includes("L5") &&
									arr[i].name.includes(shp_L5.name)
								) {
									check = true;
								} else {
									check = false;
								}
							}
							//createTime不相同
							let param = {
								title: arr[i].produceTime,
								expand: true,
								checked: check,
								contextmenu: true,
								children: [
									{
										title: arr[i].level,
										produceTime: arr[i].produceTime,
										expand: expand,
										checked: check,
										contextmenu: true,
										children: [
											{
												title: arr[i].name,
												produceTime: arr[i].produceTime,
												level: arr[i].level,
												id: arr[i].id,
												meta: arr[i].meta,
												path: arr[i].path,
												dataId: arr[i].dataId,
												region: arr[i].region,
												status: arr[i].status,
												tsakId: arr[i].taskId,
												thumb: arr[i].thumb,
												contextmenu: true,
												checked: check,
												expand: expand,
											},
										],
									},
								],
							};
							// 判断节点的状态
							if (param.children[0].children[0].status == "normal") {
								Arr.push(param);
								j++;
							}
						}
					}
				} else {
					let param = {
						title: arr[i].name,
						id: arr[i].id,
						taskId: arr[i].taskId,
						region: arr[i].region,
						checked: check,
						expande: false,
						contextmenu: true,
						status: "normal",
					};

					if (arr[i].status == "normal") {
						Arr.push(param);
						j++;
					}
				}
			}

			let dataTrue = [];
			let dataLeafShp = [];
			let dataLeafImg = [];
			for (let i = 0; i < Arr.length; i++) {
				if (Arr[i].children[0].children[0]) {
					for (let j = 0; j < Arr[i].children.length; j++) {
						let ArrChildren = Arr[i].children[j];

						for (let k = 0; k < ArrChildren.children.length; k++) {
							if (ArrChildren.children[k].checked) {
								ArrChildren.checked = true;
								Arr[i].checked = true;
								dataTrue.push(ArrChildren);
								dataTrue.push(Arr[i]);
								dataTrue.push(ArrChildren.children[k]);
								if (ArrChildren.children[k].title.includes(".shp")) {
									dataLeafShp.push(ArrChildren.children[k]);
								}
								if (!ArrChildren.children[k].title.includes(".shp")) {
									dataLeafImg.push(ArrChildren.children[k]);
								}
							}
						}
					}
				}
			}
			console.log(dataLeafImg, dataLeafShp, "勾选的叶子节点和shp节点");
			debugger;
			//删除定位的影像
			if (this.layImgId) {
				for (let i = 0; i < this.layImgId.length; i++) {
					let imgPath = this.layImgId[i].path + "/" + this.layImgId[i].title;
					if (this.layImgId[i].checked ? true : false) {
						this.removeLayer("picture" + imgPath);
					} else {
						this.removeLayer("picture" + imgPath);
					}
				}
			}
			//删除定位的矢量
			if (this.layShpId) {
				for (let i = 0; i < this.layShpId.length; i++) {
					if (this.layShpId[i].checked ? true : false) {
						this.removeLayer(this.layShpId[i].id + "");
					} else {
						this.removeLayer(this.layShpId[i].id + "");
					}
				}
			}

			for (let i = 0; i < dataLeafImg.length; i++) {
				this.layImgId.push(dataLeafImg[i]);
				this.getTreeNodeInfo(dataTrue, dataLeafImg[i]);
			}

			this.layShpId.push(dataLeafShp[0]);

			this.getTreeNodeInfo(dataTrue, dataLeafShp[0]);

			return (this.dataTreeList = Arr);
			//console.log(Arr,"this.dataTreeList----weixing")
		},
		getTreeNodeInfoFire(data, item) {
			console.log(data, item);
			let dataNote0 = []; //根节点
			let dataNote1 = []; //产品级别节点
			let nodes = [];
			this.selcetFilePath = [];
			data.forEach((node) => {
				//勾选的叶子节点数据
				if (!node.children) {
					let filePath = node.path + "/" + node.title;
					this.selcetFilePath.push(filePath);
					console.log(this.selcetFilePath);
					nodes.push(node);
				}

				//储存勾选的日期父节点数据
				if (node.title.split("-").length == 3) {
					dataNote0.push(node);
				}

				//勾选的等级节点数据
				if (!node.title.includes(".") && node.title.includes("L")) {
					dataNote1.push(node);
				}
				this.nodes = nodes;
				this.dataNote1 = dataNote1;
				this.dataNote0 = dataNote0;
			});
			this.$emit("upDateLeaf", this.selcetFilePath);
			this.loadShpAndImgFire(item, "beforeMap");
		},
		loadShpAndImgFire(node, mapDiv) {
			debugger;
			let dataNote0 = this.dataNote0;
			let dataNote1 = this.dataNote1;
			let nodes = this.nodes;
			//当前勾选的是叶子节点
			if (!node.children && node.checked == true) {
				dataNote1.forEach((l) => {
					if (JSON.stringify(l.children).indexOf(JSON.stringify(node)) != -1) {
						dataNote0.forEach((d) => {
							if (JSON.stringify(d.children).indexOf(JSON.stringify(l)) != -1) {
								this.showImgFire(node, mapDiv);
							}
						});
					}
				});
			} else if (!node.children && node.checked == false) {
				// let imgPath = node.path + "/" + node.title;
				// let layerID = "picture" + imgPath;
				let layerID = "";
				if (
					node.title.includes(".tif") ||
					node.title.includes(".img") ||
					node.title.includes(".jpg")
				) {
					layerID = "picture";
				} else {
					layerID = "shpId";
				}
				if (node.checked ? false : true) {
					this.removeLayer(layerID);
				} else if (mapDiv === "afterMap") {
					this.removeLayer(layerID);
				} else if (mapDiv === "beforeMap" && this.map.getLayer(layerID)) {
					this.$Message.info("当前地图已添加该影像，请勿重复加载！");
					return;
				}
			}
			//勾选父节点。
			if (
				!node.title.includes(".") &&
				node.title.includes("L") &&
				node.checked == true
			) {
				for (let i = 0; i < nodes.length; i++) {
					let a = JSON.stringify(node.children).indexOf(
						JSON.stringify(nodes[i])
					);

					if (
						JSON.stringify(node.children).indexOf(JSON.stringify(nodes[i])) !=
						-1
					) {
						dataNote0.forEach((d) => {
							if (
								JSON.stringify(d.children).indexOf(JSON.stringify(node)) != -1
							) {
								this.showImgFire(nodes[i], mapDiv);
							}
						});
					}
				}
			} else if (
				!node.title.includes(".") &&
				node.title.includes("L") &&
				node.checked == false
			) {
				for (let i = 0; i < nodes.length; i++) {
					if (
						JSON.stringify(node.children).indexOf(JSON.stringify(nodes[i])) !=
						-1
					) {
						console.log(nodes);
						let layerID = "";
						if (
							nodes[i].title.includes(".tif") ||
							nodes[i].title.includes(".img") ||
							nodes[i].title.includes(".jpg")
						) {
							layerID = "picture";
						} else {
							layerID = "shpId";
						}
						if (nodes[i].checked ? true : false) {
							this.removeLayer(layerID);
						} else if (mapDiv === "afterMap") {
							this.removeLayer(layerID);
						} else if (mapDiv === "beforeMap" && this.map.getLayer(layerID)) {
							return;
						}
					}
				}
			}
			//勾选日期节点
			if (node.title.split("-").length == 3 && node.checked === true) {
				console.log(node, "nodeo");
				for (let i = 0; i < dataNote1.length; i++) {
					let b = JSON.stringify(node.children).indexOf(
						JSON.stringify(dataNote1[i])
					);
					console.log(b, "b");
					if (
						JSON.stringify(node.children).indexOf(
							JSON.stringify(dataNote1[i])
						) != -1
					) {
						console.log(node, "node1");
						for (let j = 0; j < nodes.length; j++) {
							if (
								JSON.stringify(dataNote1[i].children).indexOf(
									JSON.stringify(nodes[j])
								) != -1
							) {
								console.log("zuihou ");
								this.showImgFire(nodes[j], mapDiv);
							}
						}
					}
				}
			} else if (node.title.split("-").length == 3 && node.checked == false) {
				for (let i = 0; i < node.children.length; i++) {
					for (let j = 0; j < node.children[i].children.length; j++) {
						let layerID = "";
						console.log(node);
						if (
							node.children[i].children[j].title.includes(".tif") ||
							node.children[i].children[j].title.includes(".img") ||
							node.children[i].children[j].title.includes(".jpg")
						) {
							layerID = "picture";
						} else {
							layerID = "shpId";
						}

						if (node.children[i].children[j].checked ? true : false) {
							this.removeLayer(layerID);
						} else if (mapDiv === "afterMap") {
							this.removeLayer(layerID);
						} else if (mapDiv === "beforeMap" && this.map.getLayer(layerID)) {
							return;
						}
					}
				}
			}
		},

		getDotImgAndShp() {
			this.$parent.dotImgAndShp();
		},
		//父组件绘制发生变化时更新区域结果列表和保存参数更新
		async updateRegionResultAndSave() {
			await this.getRegionResult();
			this.saveEmergencyTask();
			this.getCustomerRegionList(); //自定义区域列表
		},
		handleSelectGroup(code, i) { },

		changeColor(val) {
			this.show = !this.show;
			this.show ? (this.active = true) : (this.active = false);
			this.inputStyle = val.bgStyle;
			this.getIrgbaData();
		},
		getIrgbaData() {
			let value = this.inputStyle.slice(25, -1).replace(/\s*/g, "").split(",");
			let colorArr = [];
			for (let i = 0; i < value.length; i++) {
				let color = this.hexToRgb(value[i]);
				colorArr.push(color);
			}
			let section = this.calcGroup(0, 255, colorArr.length);
			for (let i = 0; i < colorArr.length; i++) {
				colorArr[i] = [
					Number(section[i]),
					colorArr[i][0],
					colorArr[i][1],
					colorArr[i][2],
					255,
				];
			}
			this.demColor = colorArr;
		},
		hexToRgb(hex) {
			// 16进制色值转换为rgb值
			let rgb = [];
			for (let i = 1; i < 7; i += 2) {
				rgb.push(parseInt("0x" + hex.slice(i, i + 2)));
			}
			return rgb;
		},
		calcGroup(min, max, count) {
			// 计算两个数值间的分段值
			if (count < 2) return [];
			let group = [];
			let span = (max - min) / (count - 1);
			for (let i = 0; i < count; i++) {
				group.push((min + i * span).toFixed(0));
			}
			return group;
		},
		openShow() {
			this.show = !this.show;
			this.show ? (this.active = true) : (this.active = false);
		},
		//自定义区域编号列表
		getCustomerRegionList() {
			let _this = this;
			_this.customerRegionList = [];
			let path = this.$api.taskManageApi.riskTaskQueryId + this.taskID;
			// let param = {
			//   taskId: this.taskID,
			//   // regionType: 1,
			// };
			this.http.get(path).then((res) => {
				if (res.data.success && res.data.data) {
					let custom = res.data.data.areas;
					let arr = [];
					custom.forEach((item) => {
						if (item.geoType == "polygon") {
							arr.push(item);
						}
					});
					for (let i = 0; i < arr.length; i++) {
						let temp = {
							geoName: arr[i].geoName,
							geoType: "polygon",
							geoValue: arr[i].geoValue,
							number: i,
						};
						_this.customerRegionList.push(temp);
					}
					console.log(_this.customerRegionList);
				} else {
					this.$Message.error("自定义区域编号列表查询失败！");
				}
			});
		},
		//数组去重
		unique(arr) {
			let hash = [];
			for (let i = 0; i < arr.length; i++) {
				if (hash.indexOf(arr[i]) === -1) {
					hash.push(arr[i]);
				}
			}
			return hash;
		},
		//获取线框绘制范围
		getLineCoordinate(data) {
			let result = [
				[Number(data.TopLeftLongitude), Number(data.TopLeftLatitude)],
				[Number(data.TopRightLongitude), Number(data.TopRightLatitude)],
				[Number(data.BottomRightLongitude), Number(data.BottomRightLatitude)],
				[Number(data.BottomLeftLongitude), Number(data.BottomLeftLatitude)],
				// [Number(data.TopLeftLongitude), Number(data.TopLeftLatitude)],
			];
			return result;
		},
		//获取缩略图范围
		getExternalRectangCoordinatelOfImg(imageCoordinate) {
			let long = []; //经度
			let lat = []; //纬度
			imageCoordinate.forEach((element) => {
				long.push(element[0]);
				lat.push(element[1]);
			});
			long = this.unique(long);
			lat = this.unique(lat);
			let minX = Math.min(...long);
			let minY = Math.min(...lat);
			let maxX = Math.max(...long);
			let maxY = Math.max(...lat);
			//绘制缩略图需要四个点坐标  绘制线框需要5个点坐标
			let result = [
				[minX, maxY],
				[maxX, maxY],
				[maxX, minY],
				[minX, minY],
			];
			return result;
		},

		//缩放至最佳比例尺
		showToCenter(coordinates) {
			// 计算 并 移动到中心点
			let minGlobalX = 180,
				minGlobalY = 90,
				maxGlobalX = -180,
				maxGlobalY = -90;

			for (let lineDatas of coordinates) {
				for (var i = 0; i < lineDatas.length; i++) {
					let gLineData = lineDatas[i];
					if (gLineData.length <= 0) continue;

					for (let j = 0; j < gLineData.length; j++) {
						if (minGlobalX > parseFloat(gLineData[j][0])) {
							minGlobalX = parseFloat(gLineData[j][0]);
						}
						if (maxGlobalX < parseFloat(gLineData[j][0])) {
							maxGlobalX = parseFloat(gLineData[j][0]);
						}
						if (minGlobalY > parseFloat(gLineData[j][1])) {
							minGlobalY = parseFloat(gLineData[j][1]);
						}
						if (maxGlobalY < parseFloat(gLineData[j][1])) {
							maxGlobalY = parseFloat(gLineData[j][1]);
						}
					}
				}
			}

			if (
				minGlobalX == 180 &&
				minGlobalY == 90 &&
				maxGlobalX == -180 &&
				maxGlobalY == -90
			) {
				return;
			}

			let centerGlobalX = 0;
			let centerGlobalY = 0;
			if (maxGlobalX === -180 && minGlobalX === 180) {
				centerGlobalX = 116.4;
				centerGlobalY = 39.9;
			} else {
				centerGlobalX = (minGlobalX + maxGlobalX) / 2;
				centerGlobalY = (minGlobalY + maxGlobalY) / 2;
			}

			let centermoddle = [];
			centermoddle.push(centerGlobalX);
			centermoddle.push(centerGlobalY);
			//视图范围比数据范围大20%
			let viewWidth = 0;
			let viewHeight = 0;
			if (maxGlobalX === -180 && minGlobalX === 180) {
				viewWidth = (minGlobalX - maxGlobalX) * 1.2;
				viewHeight = (minGlobalY - maxGlobalY) * 1.2;
			} else {
				viewWidth = (maxGlobalX - minGlobalX) * 1.2;
				viewHeight = (maxGlobalY - minGlobalY) * 1.2;
			}

			let ratio = Math.sqrt(Math.sqrt(Math.sqrt(2))); //视图范围每扩大或缩小ratio倍，缩放等级对应减少或增加0.125

			let indexX = 6; //初始缩放等级为7
			let zoomBaseX = 5.96; //缩放等级为7时，经度范围为5.96
			if (viewWidth > zoomBaseX) {
				//如果实际范围比基准范围大，基准范围按比例扩大，直至大于实际范围，获取此时缩放等级
				while ((zoomBaseX = zoomBaseX * ratio) < viewWidth) {
					indexX -= 0.125;
				}
			} else {
				//如果实际范围比基准范围小，基准范围按比例缩小，直至小于实际范围，获取此时缩放等级
				while ((zoomBaseX = zoomBaseX / ratio) > viewWidth) {
					indexX += 0.125;
				}
			}

			let indexY = 6; //初始缩放等级为7
			let zoomBaseY = 1.91; //缩放等级为7时，纬度范围为1.91
			if (viewHeight > zoomBaseY) {
				while ((zoomBaseY = zoomBaseY * ratio) < viewHeight) {
					indexY -= 0.125;
				}
			} else {
				while ((zoomBaseY = zoomBaseY / ratio) > viewHeight) {
					indexY += 0.125;
				}
			}

			//在经纬度分别获取的缩放等级中，获取比较小的值作为缩放等级，确保数据能完全显示
			let index = indexX < indexY ? indexX : indexY;
			this.map.flyTo({
				center: centermoddle,
				zoom: index, // 缩放比例
			});
		},

		//imgId 影像id  isShow 影像是否要显示  mapDiv地图，目前地图有卷帘功能，有两个地图
		async getFirstA(imgId, isShow, mapDiv) {
			let _this = this;
			let path = this.$api.taskManageApi.queryAssociateDataById + imgId;
			let { data } = await axios.get(path);
			let imgPath = data.data.path + "/" + data.data.name;
			let layerID = "picture" + imgPath;
			if (!isShow) {
				_this.removeLayer(layerID);
				return;
			} else if (mapDiv === "afterMap") {
				_this.removeLayer(layerID);
			} else if (mapDiv === "beforeMap" && _this.map.getLayer(layerID)) {
				//  this.$Message.info("当前地图已添加该影像，请勿重复加载！");
				return;
			}
			let bounds = this.getImageBounds(data.data);
			let tempMap = mapDiv === "beforeMap" ? this.map : this.afterMap;
			tempMap.addLayer({
				id: layerID,
				type: "raster",
				source: {
					type: "image",
					url: data.data.thumb,
					coordinates: bounds,
				},
				paint: {
					"raster-opacity": 1,
				},
			});
			//地图缩放
			// this.showToCenter([[bounds]]);
		},
		async getFirstAFire(imgId, isShow, mapDiv) {
			let _this = this;
			let path = this.$api.taskManageApi.queryAssociateDataById + imgId;
			let { data } = await axios.get(path);
			let layerID = "picture";
			if (!isShow) {
				_this.removeLayer(layerID);
				return;
			} else if (mapDiv === "afterMap") {
				_this.removeLayer(layerID);
			} else if (mapDiv === "beforeMap" && _this.map.getLayer(layerID)) {
				//  this.$Message.info("当前地图已添加该影像，请勿重复加载！");
				return;
			}
			let bounds = this.getImageBounds(data.data);
			let tempMap = mapDiv === "beforeMap" ? this.map : this.afterMap;
			let source = {
				type: "image",
				url: data.data.thumb,
				coordinates: bounds,
			};
			tempMap.addSource("picture", source);
			tempMap.addLayer("picture", {
				id: "picture",
				type: "raster",
				source: "picture",
				paint: {
					"raster-opacity": 1,
				},
			});
			//地图缩放
			// this.showToCenter([[bounds]]);
		},

		//得到L1A影像的显示范围
		getImageBounds(data) {
			let bounds = [];
			let envelop = [];
			let dataMeta = "";
			let region = data.region;
			let bound = region.split(",");
			let Arr = [];
			for (let i = 1; i < bound.length; i++) {
				if (i < bound.length - 1) {
					for (let j = 0; j < 2; j++)
						Arr.push(Number(bound[i].trim().split(" ")[j]));
				} else {
					for (let j = 0; j < 2; j++)
						Arr.push(Number(bound[i].replace("))", "").trim().split(" ")[j]));
				}
			}
			if (region) {
				let a = Arr.length;
				bounds = [
					[Arr[a - 2], Arr[a - 1]],
					[Arr[a - 4], Arr[a - 3]],
					[Arr[a - 6], Arr[a - 5]],
					[Arr[a - 8], Arr[a - 7]],
				];
			} else if (data.meta) {
				dataMeta = this.$x2js.xml2js(data.meta); //xml为需要转换的字符串xml
				envelop = dataMeta.ProductMetaData;
				bounds = this.getLineCoordinate(envelop);
			} else {
				this.$Message.warning("无法确定影像边界");
			}
			return bounds;
		},
		//切片发布
		getInfo(imgPath, isShow, mapDiv) {
			let path = url1 + "/transferPost";
			axios
				.get(path, {
					params: {
						url: "?request=GetImageInfo",
						params: JSON.stringify(imgPath),
					},
				})
				.then((res) => {
					let envelop = res.data[0].envelope;
					let bandCount = res.data[0].band_count;
					let left = envelop.left;
					let right = envelop.right;
					let top = envelop.top;
					let bottom = envelop.bottom;
					// let nodata_value=res.data[0].nodata_value;
					let bounds = [
						[left, bottom],
						[right, top],
					];
					let kind = "";
					if (bandCount == 1) {
						kind = "dem";
						//externalNodataValue=[0];
					} else {
						kind = "trueColor";
					}

					let bandMap = [4, 3, 2];
					let stretch = {
						kind: "standardDeviation",
						percent: 0.2,
					};
					let layerID = "picture" + imgPath;
					if (!isShow) {
						this.removeLayer(layerID);
						return;
					} else if (mapDiv === "afterMap") {
						this.removeLayer(layerID);
					} else if (mapDiv === "beforeMap" && this.map.getLayer(layerID)) {
						// this.$Message.info("当前地图已添加该影像，请勿重复加载！");
						return;
					}

					let info = {
						info: [
							{
								path: `${imgPath}`,
								style: {
									kind: `${kind}`,
									bandMap: bandMap,
									stretch: stretch,
								},
							},
						],
					};

					let stretch1 = {
						kind: this.styleLaterStretch,
						percent: this.styleLaterPercent,
						// externalNodataValue:externalNodataValue
					};
					let info1 = {
						info: [
							{
								path: `${imgPath}`,
								style: {
									kind: `${kind}`,
									bandMap: this.styleLaterBands,
									stretch: stretch1,
								},
							},
						],
					};

					if (this.styleLaterPercent == -1) {
						const source = {
							type: "raster",
							bounds: [...bounds[0], ...bounds[1]],
							tiles: [
								`${url3}/v1?request=GetTile&TILECOL={x}&TILEROW={y}&TILEMATRIX={z}&info=${encodeURIComponent(
									JSON.stringify(info)
								)}`,
							],
							tileSize: 256, // 返回图片大小默认是256
						};
						let tempMap = mapDiv === "beforeMap" ? this.map : this.afterMap;
						tempMap.addLayer({
							id: layerID,
							type: "raster",
							source: source,
							paint: {
								"raster-opacity": 1,
							},
						});
						if (this.taskID == 1) {
							if (this.map.getLayer("fireLayerId")) {
								tempMap.moveLayer(layerID, "fireLayerId");
							}
						}
					} else {
						const source = {
							type: "raster",
							bounds: [...bounds[0], ...bounds[1]],
							tiles: [
								`${url3}/v1?request=GetTile&TILECOL={x}&TILEROW={y}&TILEMATRIX={z}&info=${encodeURIComponent(
									JSON.stringify(info1)
								)}`,
							],
							tileSize: 256, // 返回图片大小默认是256
						};
						let tempMap = mapDiv === "beforeMap" ? this.map : this.afterMap;
						tempMap.addLayer({
							id: layerID,
							type: "raster",
							source: source,
							paint: {
								"raster-opacity": 1,
							},
						});
						if (this.taskID == 1) {
							if (this.map.getLayer("fireLayerId")) {
								tempMap.moveLayer(layerID, "fireLayerId");
							}

						}
					}
				});
		},
		getInfoFire(imgPath, isShow, mapDiv) {
			let path = url1 + "/transferPost";
			axios
				.get(path, {
					params: {
						url: "?request=GetImageInfo",
						params: JSON.stringify(imgPath),
					},
				})
				.then((res) => {
					let envelop = res.data[0].envelope;
					let bandCount = res.data[0].band_count;
					let left = envelop.left;
					let right = envelop.right;
					let top = envelop.top;
					let bottom = envelop.bottom;
					// let nodata_value=res.data[0].nodata_value;
					let bounds = [
						[left, bottom],
						[right, top],
					];
					let kind = "";
					if (bandCount == 1) {
						kind = "dem";
						//externalNodataValue=[0];
					} else {
						kind = "trueColor";
					}

					let bandMap = [4, 3, 2];
					let stretch = {
						kind: "standardDeviation",
						percent: 0.2,
					};
					let layerID = "picture";

					if (!isShow) {
						this.removeLayer(layerID);
						return;
					} else if (mapDiv === "afterMap") {
						this.removeLayer(layerID);
					} else if (mapDiv === "beforeMap" && this.map.getLayer(layerID)) {
						// this.$Message.info("当前地图已添加该影像，请勿重复加载！");
						return;
					}

					let info = {
						info: [
							{
								path: `${imgPath}`,
								style: {
									kind: `${kind}`,
									bandMap: bandMap,
									stretch: stretch,
								},
							},
						],
					};

					let stretch1 = {
						kind: this.styleLaterStretch,
						percent: this.styleLaterPercent,
						// externalNodataValue:externalNodataValue
					};
					let info1 = {
						info: [
							{
								path: `${imgPath}`,
								style: {
									kind: `${kind}`,
									bandMap: this.styleLaterBands,
									stretch: stretch1,
								},
							},
						],
					};

					if (this.styleLaterPercent == -1) {
						const source = {
							type: "raster",
							bounds: [...bounds[0], ...bounds[1]],
							tiles: [
								`${url3}/v1?request=GetTile&TILECOL={x}&TILEROW={y}&TILEMATRIX={z}&info=${encodeURIComponent(
									JSON.stringify(info)
								)}`,
							],
							tileSize: 256, // 返回图片大小默认是256
						};
						let tempMap = mapDiv === "beforeMap" ? this.map : this.afterMap;
						tempMap.addSource("picture", source);
						tempMap.addLayer("picture", {
							id: layerID,
							type: "raster",
							source: "picture",
							paint: {
								"raster-opacity": 1,
							},
						});
					} else {
						const source = {
							type: "raster",
							bounds: [...bounds[0], ...bounds[1]],
							tiles: [
								`${url3}/v1?request=GetTile&TILECOL={x}&TILEROW={y}&TILEMATRIX={z}&info=${encodeURIComponent(
									JSON.stringify(info1)
								)}`,
							],
							tileSize: 256, // 返回图片大小默认是256
						};
						let tempMap = mapDiv === "beforeMap" ? this.map : this.afterMap;
						tempMap.addSource("picture", source);
						tempMap.addLayer("picture", {
							id: layerID,
							type: "raster",
							source: "picture",
							paint: {
								"raster-opacity": 1,
							},
						});
						// tempMap.moveLayer('raster', 'points')
					}
				});
		},

		//火点判读
		fireInterpretation() {
			let _this = this;
			this.fireInterpretationShow = true;
			let path = this.$api.taskManageApi.fireInterpretation;
			let param = {
				taskId: this.taskID,
				dataId: this.currentTreeNode.id,
			};

			this.http.get(path, param).then((res) => {
				if (res.data.success && res.data.data) {
					let fire = res.data.data[0];
					let arrfire = [];
					this.fireGeojsonArr = [];
					_this.fireGeojsonList = {
						type: "FeatureCollection",
						features: [],
					};
					fire.fields.forEach((item) => {
						let temp = {
							id: fire.id,
							name: item.fireName,
							coordinate: item.coordinate,
							location: "", //界面展示字段
							geoJson: wktToGeoJson(item.coordinate),
							produceTime: fire.produceTime,
							productName: fire.productName,
							status: item.status,
							oldStatus: item.status, //用保存操作之前的原始值
						};

						let feature = {
							type: "Feature",
							geometry: temp.geoJson,
							properties: {
								valuecolor: "#ff0000",
								id: fire.id,
							},
						};
						_this.fireGeojsonList.features.push(feature);
						this.fireGeojsonArr.push(temp.geoJson);
						temp.location =
							"E" +
							temp.geoJson.coordinates[0] +
							" " +
							"N" +
							temp.geoJson.coordinates[1];
						arrfire.push(temp);
					});
					this.fireData = arrfire;
					this.addFirePointLayer("firelayer", this.fireGeojsonList);
					this.hightPointLayer("firelayer", this.fireGeojsonList, "beforeMap");
				}
			});
		},
		fireInterpretationCancel() {
			this.fireSelectedModal = false;
			this.currentFireRow.status = this.currentFireRow.oldStatus;
		},
		//火点判读保存
		fireInterpretationOk() {
			let _this = this;
			let path = this.$api.taskManageApi.updateFire;

			let param = {
				id: _this.currentFireRow.id,
				fields: [
					{
						coordinate: _this.currentFireRow.coordinate,
						fireName: _this.currentFireRow.name,
						status: _this.currentFireRow.status,
					},
				],
			};

			this.http.post(path, param).then((res) => {
				this.fireSelectedModal = false;
				if (res.data.success) {
					this.$Message.success("保存成功");
				} else {
					this.$Message.error(res.message);
					_this.currentFireRow.status = _this.currentFireRow.oldStatus;
				}
			});
		},
		fireShow(row, index) {
			// console.log(index);
			// let e = index.coordinate.split(",")[0].slice(1);
			// let n = index.coordinate.split(",")[1].slice(2);
			// // this.addMarker(e,n);
		},
		getFire(row) {
			// console.log(row);
		},
		// addMarker(e,n){
		//    marker = new mapboxgl.Marker({
		//       scale: 0.5,
		//     })
		//       .setLngLat([e, 89])
		//       .addTo(this.afterMap)
		// },
		//shp矢量修改
		async shpColorView() {
			this.shpColorShow = true;
			let path1 =
				this.$api.taskManageApi.queryAssociateDataById +
				this.currentTreeNode.id;
			let { data } = await axios.get(path1);
			this.shpData = data.data;
		},
		shpColorOk() {
			this.getRegionByShpColor(this.shpData);
			this.shpColorShow = false;
		},
		//元数据缩放到图层
		async fixScaleMapL1A() {
			const path =
				this.$api.taskManageApi.queryAssociateDataById +
				this.currentTreeNode.id;
			let { data } = await axios.get(path);
			let bounds = this.getImageBounds(data.data);

			this.showToCenter([[bounds]]);
		},
		//数据定位
		fixScaleMapTile() {
			let imgPath =
				this.currentTreeNode.path + "/" + this.currentTreeNode.title;
			let path = url1 + "/transferPost";
			axios
				.get(path, {
					params: {
						url: "?request=GetImageInfo",
						params: JSON.stringify([imgPath]),
					},
				})
				.then((res) => {
					let envelop = res.data[0].envelope;

					let left = envelop.left;
					let right = envelop.right;
					let top = envelop.top;
					let bottom = envelop.bottom;
					let bounds = [
						[left, bottom],
						[right, top],
					];
					this.map.fitBounds(bounds, {
						linear: true,
						padding: { top: 25, bottom: 25, left: 25, right: 25 },
					});
				});
		},

		//shp数据定位
		fixScaleMapShp() {
			let layerId = this.currentTreeNode.id + "";
			//  console.log(layerId,this.currentTreeNode,"lll")
			// this.removeLayer(layerId);
			let path = this.$api.riskMonitorApi.addShpFileQuery;
			let param = {
				fileName: this.currentTreeNode.path + "/" + this.currentTreeNode.title,
			};
			this.http.post(path, param).then((res) => {
				if (res.data.code == 200) {
					let shpDataRegion = res.data.data;

					this.showToCenter(shpDataRegion.features[0].geometry.coordinates);
				}
			});
		},

		//样式设置
		// 样式
		async styleOfTreeData() {
			let imgPath =
				this.currentTreeNode.path + "/" + this.currentTreeNode.title;
			const path = url1 + "/transferPost";
			axios
				.get(path, {
					params: {
						url: "?request=GetImageInfo",
						params: JSON.stringify([imgPath]),
					},
				})
				.then((res) => {
					let bands = res.data[0].bands;
					let imgBands = [];
					let imgBandsMin = [];
					let imgBandsMax = [];
					if (res.data[0]) {
						for (let i = 0; i < bands.length; i++) {
							imgBands.push(bands[i].name);
							imgBandsMin.push(bands[i].min);
							imgBandsMax.push(bands[i].max);
						}

						this.bandCount = res.data[0].band_count;
						this.bandOptions = imgBands.map((d) => {
							return { label: d, value: d };
						});
					}
				});
			this.styleShow = true;
		},
		//单波段
		colorApplication() {
			let imgpath =
				this.currentTreeNode.path + "/" + this.currentTreeNode.title;
			let layerID = "picture" + imgpath;
			this.removeLayer(layerID);
			const path = url1 + "/transferPost";
			axios
				.get(path, {
					params: {
						url: "?request=GetImageInfo",
						params: JSON.stringify([imgpath]),
					},
				})
				.then((res) => {
					let envelop = res.data[0].envelope;
					let left = envelop.left;
					let right = envelop.right;
					let top = envelop.top;
					let bottom = envelop.bottom;
					let bounds = [
						[left, bottom],
						[right, top],
					];
					if (res.data[0] != null) {
						this.bands = res.data[0].bands;
					}
					let stretchStyle = this.stretchStyle;
					this.styleLaterStretch = stretchStyle;

					let bandCount = this.bandCount;
					let kind = "";
					let lut = [];
					if (bandCount == 1) {
						kind = "dem";
						for (let i = 0; i < this.demColor.length; i++) {
							lut.push(this.demColor[i]);
						}
					} else {
						kind = "trueColor";
					}
					let bandMap = [];
					if (this.styleBands.length === 0) {
						let styleBands = ["B4", "B3", "B2"];
						bandMap = styleBands.map(function (d) {
							return Number(d.replace("B", ""));
						});
					} else {
						bandMap = this.styleBands.map(function (d) {
							return Number(d.replace("B", ""));
						});
					}
					this.styleLaterBands = bandMap;

					let percent = (this.percent / 100).toFixed(2);
					this.styleLaterPercent = percent;

					let stretch = {};

					if (stretchStyle != "minimumMaximum") {
						stretch = {
							kind: `${stretchStyle}`,
							percent: percent,
						};
					} else {
						stretch = {
							kind: `${stretchStyle}`,
							minimum: -1000,
							maximum: 8000,
						};
					}

					let info = {
						info: [
							{
								path: `${imgpath}`,
								style: {
									kind: `${kind}`,
									lut: lut,
									bandMap: bandMap,
									// bandCount:bandCount,
									stretch: stretch,
								},
							},
						],
					};
					const source = {
						type: "raster",
						bounds: [...bounds[0], ...bounds[1]],
						tiles: [
							`${url3}/v1?request=GetTile&TILECOL={x}&TILEROW={y}&TILEMATRIX={z}&info=${encodeURIComponent(
								JSON.stringify(info)
							)}`,
						],
						tileSize: 256, // 返回图片大小默认是256
					};
					this.map.addLayer({
						id: layerID,
						type: "raster",
						source: source,
						paint: {
							"raster-opacity": 1,
						},
					});
					this.percent = 20;
				});
			this.styleShow = false;
			//清除参数
		},
		//申请应用
		applicationTile() {
			let imgpath =
				this.currentTreeNode.path + "/" + this.currentTreeNode.title;
			let layerID = "picture" + imgpath;
			this.removeLayer(layerID);
			const path = url1 + "/transferPost";
			axios
				.get(path, {
					params: {
						url: "?request=GetImageInfo",
						params: JSON.stringify([imgpath]),
					},
				})
				.then((res) => {
					let envelop = res.data[0].envelope;
					let left = envelop.left;
					let right = envelop.right;
					let top = envelop.top;
					let bottom = envelop.bottom;
					let bounds = [
						[left, bottom],
						[right, top],
					];
					if (res.data[0] != null) {
						this.bands = res.data[0].bands;
					}
					let stretchStyle = this.stretchStyle;
					this.styleLaterStretch = stretchStyle;

					let bandCount = this.bandCount;
					let kind = "";
					if (bandCount == 1) {
						kind = "dem";
					} else {
						kind = "trueColor";
					}
					let bandMap = [];
					if (this.styleBands.length === 0) {
						let styleBands = ["B4", "B3", "B2"];
						bandMap = styleBands.map(function (d) {
							return Number(d.replace("B", ""));
						});
					} else {
						bandMap = this.styleBands.map(function (d) {
							return Number(d.replace("B", ""));
						});
					}
					this.styleLaterBands = bandMap;

					let percent = (this.percent / 100).toFixed(2);
					this.styleLaterPercent = percent;

					let stretch = {};

					if (stretchStyle != "minimumMaximum") {
						stretch = {
							kind: `${stretchStyle}`,
							percent: percent,
						};
					} else {
						stretch = {
							kind: `${stretchStyle}`,
							minimum: -1000,
							maximum: 8000,
						};
					}

					let info = {
						info: [
							{
								path: `${imgpath}`,
								style: {
									kind: `${kind}`,
									bandMap: bandMap,
									// bandCount:bandCount,
									stretch: stretch,
								},
							},
						],
					};
					const source = {
						type: "raster",
						// bounds: [...bounds[0], ...bounds[1]],
						tiles: [
							`${url3}/v1?request=GetTile&TILECOL={x}&TILEROW={y}&TILEMATRIX={z}&info=${encodeURIComponent(
								JSON.stringify(info)
							)}`,
						],
						tileSize: 256, // 返回图片大小默认是256
					};
					this.map.addLayer({
						id: layerID,
						type: "raster",
						source: source,
						paint: {
							"raster-opacity": 1,
						},
					});
					// this.map.fitBounds(bounds, {
					//   linear: true,
					//   padding: { top: 25, bottom: 25, left: 25, right: 25 },
					// });
					// this.stretchStyle = "";
					//  this.styleBands=[];
					this.percent = 20;
				});
			this.styleShow = false;
			//清除参数
		},

		//取消样式
		deleteStyle() {
			this.styleShow = false;
		},
		//切换rgb样式
		settingRgb() {
			this.rgbSettingShow = true; //Rgb设置
			this.strSettingShow = false; //拉伸设置
			this.coloSettingShow = false; //色彩映射设置
		},
		//切换Stretch样式
		settingStrecth() {
			this.rgbSettingShow = false; //;Rgb设置
			this.strSettingShow = true; //拉伸设置
			this.coloSettingShow = false; //色彩映射设置
		},
		// settingColor() {
		//   (this.rgbSettingShow = false), //Rgb设置
		//     (this.strSettingShow = false), //拉伸设置
		//     (this.coloSettingShow = true); //色彩映射设置
		// },

		drawRectangle() {
			this.$emit("drawRectangle");
		},
		drawPloy() {
			this.$emit("drawPoly");
		},
		// 获取 数据目录树  原始
		getTreeDataList() {
			let path = this.$api.taskManageApi.getTreeDataList;
			let params = {
				taskId: this.taskID,
				parentId: this.parentId,
			};
			this.loading("正在请求目录树，请稍后哦~");
			this.http.get(path, params).then((res) => {
				Spin.hide();
				if (res.data.code == 200 && res.data.data) {
					this.dataList = res.data.data;
					this.$emit("dataList", this.dataList);
					this.getDataTreeList();
				} else {
					this.dataList = [];
					this.getDataTreeList();
				}
			});
		},
		// 处理  数据目录树 最终
		getDataTreeList() {
			let arr = this.dataList;

			let Arr = [];
			let expand = true;
			let j = -1;
			// 处理过程

			for (let i = 0; i < arr.length; i++) {
				if (arr[i].level) {
					// 先判断  Arr是否为空
					arr[i].produceTime = arr[i].produceTime
						? arr[i].produceTime.slice(0, 10)
						: "";
					if (Arr.length == 0) {
						if (!arr[i].level || arr[i].level.includes("L1")) {
							expand = false;
						}
						let param = {
							title: arr[i].produceTime,
							expand: true,
							contextmenu: true,
							children: [
								{
									title: arr[i].level,
									produceTime: arr[i].produceTime,
									expand: expand,
									contextmenu: true,
									children: [
										{
											title: arr[i].name,
											produceTime: arr[i].produceTime,
											level: arr[i].level,
											id: arr[i].id,
											meta: arr[i].meta,
											path: arr[i].path,
											dataId: arr[i].dataId,
											region: arr[i].region,
											status: arr[i].status,
											tsakId: arr[i].taskId,
											thumb: arr[i].thumb,
											contextmenu: true,
											expand: expand,
										},
									],
								},
							],
						};
						// 判断节点的状态
						if (param.children[0].children[0].status == "normal") {
							Arr.push(param);
							j++;
						}
					} else {
						//Arr 不为空
						if (arr[i].produceTime == Arr[j].title) {
							//createTime相同
							let k = Arr[j].children.length - 1;
							if (arr[i].level != Arr[j].children[k].title) {
								if (!arr[i].level || arr[i].level.includes("L1")) {
									expand = false;
								}
								//level不相同
								let param = {
									title: arr[i].level,
									produceTime: arr[i].produceTime,
									expand: true,
									contextmenu: true,
									children: [
										{
											title: arr[i].name,
											produceTime: arr[i].produceTime,
											level: arr[i].level,
											id: arr[i].id,
											meta: arr[i].meta,
											path: arr[i].path,
											dataId: arr[i].dataId,
											region: arr[i].region,
											status: arr[i].status,
											tsakId: arr[i].taskId,
											thumb: arr[i].thumb,
											expand: expand,
											contextmenu: true,
										},
									],
								};
								// 判断节点的状态
								if (param.children[0].status == "normal") {
									Arr[j].children.push(param);
								}
							} else {
								if (!arr[i].level || arr[i].level.includes("L1")) {
									expand = false;
								}
								let param = {
									title: arr[i].name,
									produceTime: arr[i].produceTime,
									level: arr[i].level,
									expand: expand,
									id: arr[i].id,
									meta: arr[i].meta,
									path: arr[i].path,
									dataId: arr[i].dataId,
									region: arr[i].region,
									status: arr[i].status,
									tsakId: arr[i].taskId,
									thumb: arr[i].thumb,
									contextmenu: true,
								};
								// 判断节点的状态
								if (param.status == "normal") {
									Arr[j].children[k].children.push(param);
								}
							}
						} else {
							if (!arr[i].level || arr[i].level.includes("L1")) expand = false;
							//createTime不相同
							let param = {
								title: arr[i].produceTime,
								expand: true,
								contextmenu: true,
								children: [
									{
										title: arr[i].level,
										produceTime: arr[i].produceTime,
										expand: expand,
										contextmenu: true,
										children: [
											{
												title: arr[i].name,
												produceTime: arr[i].produceTime,
												level: arr[i].level,
												id: arr[i].id,
												meta: arr[i].meta,
												path: arr[i].path,
												dataId: arr[i].dataId,
												region: arr[i].region,
												status: arr[i].status,
												tsakId: arr[i].taskId,
												thumb: arr[i].thumb,
												contextmenu: true,
												expand: expand,
											},
										],
									},
								],
							};
							// 判断节点的状态
							if (param.children[0].children[0].status == "normal") {
								Arr.push(param);
								j++;
							}
						}
					}
				} else {
					let param = {
						title: arr[i].name,
						id: arr[i].id,
						taskId: arr[i].taskId,
						region: arr[i].region,
						expande: false,
						contextmenu: true,
						status: "normal",
					};
					if (arr[i].status == "normal") {
						Arr.push(param);
						j++;
					}
				}
			}
			this.dataTreeList = Arr;
			// console.log(this.dataTreeList,"this.dataTreeList")
		},

		hideDrawer() {
			this.$emit("leftDrawerHide");
		},
		// 切换 设置
		spatialChange() {
			this.spatialShow = true;
			this.dataTreeShow = false;
		},
		// 切换 数据目录
		dataTreeChange() {
			this.spatialShow = false;
			this.dataTreeShow = true;
		},

		// 查询接口
		// getDisasterInfoById() {
		//   // console.log(this.taskID);
		//   let path =
		//     this.$api.emergencyMonitorApi.disasterTaskIdQuery + `${this.taskID}`;
		//   this.http.get(path).then((res) => {
		//     // console.log(res.data.data);
		//     if (res.data.code == 200) {
		//       let TaskData = res.data.data;
		//       this.taskName = TaskData.name;
		//       this.taskTime = TaskData.createTime;
		//       this.TaskAddress = TaskData.regionName;
		//       this.TaskDisasterType = TaskData.disasterName;
		//       this.regionProviceCode = TaskData.regionCode;
		//       this.disasterId = TaskData.disasterId;
		//       // 新增卫星、传感器和级别显示

		//       if (TaskData.params) {
		//         this.satellites = TaskData.params.satellite;
		//         this.sensors = TaskData.params.sensor;
		//         this.productLevel = TaskData.params.level;
		//       }

		//       // 获取city
		//       // this.getCityByProviceCode();

		//       //获取产品列表
		//       this.getproductList();

		//       //定位省区
		//       let code = this.regionProviceCode + "0000";
		//       this.drawGeometryByCode(code, 0);

		//       //获取区域结果
		//       this.getRegionResult();

		//       //获取使用过数据的框显示
		//       // this.initProductData();

		//       //获取查询时间
		//       // this.getQueryTime();
		//     }
		//   });
		// },

		// 获取省
		getCityByProviceCode() {
			let path = this.$api.taskManageApi.regionQueryProvince;
			this.http.get(path).then((res) => {
				if (res.data.code == 200) {
					this.regionCascader = [];
					let province = res.data.data;
					for (let i = 0; i < province.length; i++) {
						let tempdata = {
							value: province[i].code,
							label: province[i].name,
							loading: false,
							number: i,
							children: [],
							sign: "province",
						};
						this.regionCascader.push(tempdata);
					}
				}
			});
		},
		// 获取县
		async loadRegionData(item, callback) {
			let _this = this;
			item.loading = true;
			if (item.sign == "province") {
				this.cityNumber = item.number;
				let path =
					this.$api.queryDealApi.regionQueryCityByProvince + `${item.value}`;
				await this.http.get(path).then((res) => {
					if (res.data.success) {
						let CityData = res.data.data;
						let cityNum = CityData.length;
						for (let i = 0; i < cityNum; i++) {
							let tempdata1 = {
								value: CityData[i].code,
								label: CityData[i].name,
								loading: false,
								number: i,
								children: [],
							};
							this.regionCascader[item.number].children.push(tempdata1);
						}
					}
					item.loading = false;
					callback();
				});
			} else {
				let path =
					this.$api.queryDealApi.regionQueryAreaByCityCode + `${item.value}`;
				await this.http.get(path).then((res) => {
					if (res.data.success) {
						let coutyData = res.data.data;
						let tempData = {};
						for (let j = 0; j < coutyData.length; j++) {
							tempData = {
								value: coutyData[j].code,
								label: coutyData[j].name,
							};
							_this.regionCascader[_this.cityNumber].children[
								item.number
							].children.push(tempData);
						}
					}
					item.loading = false;
					callback();
				});
			}
		},

		//获取产品列表
		getproductList() {
			this.productList = [];
			let path =
				this.$api.taskManageApi.disasterQueryProductions + `${this.disasterId}`;

			this.http.get(path).then((res) => {
				if (res.data.code == 200) {
					let ProductData = res.data.data;
					let tempDataL4Lst = [];
					let tempDataL5Lst = [];
					let tempDataL6Lst = [];
					let tempDataL4 = [];
					let tempDataL5 = [];
					let tempDataL6 = [];
					for (let i = 0; i < ProductData.length; i++) {
						if (ProductData[i].prolevel == "正射") {
							tempDataL4 = {
								label: ProductData[i].productionName,
								productionTag: ProductData[i].productionTag,
								satellite: ProductData[i].satellite,
								sensor: ProductData[i].sensor,
								isCheck: false,
							};
						} else if (ProductData[i].prolevel == "要素遥感监测") {
							tempDataL5 = {
								label: ProductData[i].productionName + "(要素遥感监测)",
								productionTag: ProductData[i].productionTag,
								satellite: ProductData[i].satellite,
								sensor: ProductData[i].sensor,
								isCheck: false,
							};
						} else {
							tempDataL6 = {
								label: ProductData[i].productionName + "(应急风险监测)",
								productionTag: ProductData[i].productionTag,
								satellite: ProductData[i].satellite,
								sensor: ProductData[i].sensor,
								isCheck: false,
							};
						}
						// let tempData = {
						//   label: ProductData[i].productionName,
						//   productionTag: ProductData[i].productionTag,
						//   satellite: ProductData[i].satellite,
						//   sensor: ProductData[i].sensor,
						//   isCheck: false,
						// };
						//this.productList.push(tempData);
						if (tempDataL4.length != 0) {
							tempDataL4Lst.push(tempDataL4);
						} else if (tempDataL5.length != 0) {
							tempDataL5Lst.push(tempDataL5);
						} else if (tempDataL6.length != 0) {
							tempDataL6Lst.push(tempDataL6);
						}
					}
					this.productList = this.productList
						.concat(tempDataL6Lst)
						.concat(tempDataL5Lst)
						.concat(tempDataL4Lst);
					// this.productList.push(tempDataL4Lst);
					// this.productList.push(tempDataL5Lst);
					// this.productList.push(tempDataL6Lst);
				}
			});
		},

		drawGeometryByCode(code, type) {
			let _this = this;
			// let path = this.$api.taskManageApi.queryFeature;
			// let param = {
			//   collectionName: "area_info",
			//   orderColName: "",
			//   queryConditionList: [
			//     {
			//       compareOp: "=",
			//       fieldName: "type",
			//       fieldValue: type,
			//       relationNextOne: "AND",
			//     },
			//     {
			//       compareOp: "=",
			//       fieldName: "code",
			//       fieldValue: code,
			//     },
			//   ],
			//   queryResultList: ["wkb_geometry"],
			// };
			// console.log(param);
			// _this.http.post(path, param).then((res) => {
			//   let data = res.data.data;
			//   console.log(data);
			//   if (res.data.code == 0) {
			//     let geometry = [];
			//     if (data.data.length < 1) {
			//       _this.$Message.info("获取范围失败");
			//       return;
			//     }
			//     // geometry.push(data.data[0].geometry);
			//     _this.$emit("drawGeometry", data.data[0].geometry);
			//   } else {
			//     _this.$Message.error(res.data.message);
			//   }
			// });
			let path = this.$api.riskMonitorApi.queryFeature + code;
			_this.http.get(path).then((res) => {
				if (res.data.success) {
					let data = JSON.parse(res.data.data);

					if (data.length < 1) return _this.$Message.info("获取范围失败");
					_this.$emit("drawGeometry", data);
				} else {
					_this.$Message.error(res.data.message);
				}
			});
		},

		//获取区域结果
		async getRegionResult() {
			this.currentRegionList = []; //当前区域结果
			this.regionResultList = []; //区域结果
			this.regionResultIDList = []; //按区域查询
			//设置查询区域
			// let tempdata = {
			//   geoType: "region",
			//   geoValue: this.regionProviceCode,
			// };
			// this.currentRegionList.push(tempdata);
			// this.regionResultList.push(this.TaskAddress);

			// let path =
			//   this.$api.emergencyMonitorApi.queryAssociateAreaBytaskId +
			//   `${this.taskID}`;
			let path = this.$api.riskMonitorApi.queryAssociateArea;
			let param = {
				taskId: this.taskID,
			};
			this.http.get(path, param).then((res) => {
				if (res.data.code == 200) {
					let regionResultLists = res.data.data;
					this.taskAreaList = regionResultLists;

					for (let i = 0; i < regionResultLists.length; i++) {
						let region = regionResultLists[i];
						this.regionResultList.push(region.regionName);
						let tempRegionData = {};
						if (!region.regionWkt) {
							tempRegionData = {
								geoType: "region",
								geoValue: region.regionCode,
								code: region.regionCode,
							};
						} else {
							tempRegionData = {
								geoType: "polygon",
								geoValue: region.regionWkt,
								code: region.regionCode,
							};
						}
						this.currentRegionList.push(tempRegionData);

						// this.regionResultIDList = this.currentRegionList;
						// this.$emit("getRegionResult",this.regionResultIDList)

						// 保存ID
						let tempData1 = {
							regionName: region.regionName,
							regionID: region.id,
						};

						this.regionResultIDList.push(tempData1);
					}
				}
			});
		},
		//获取卫星数据
		getSatelleData() {
			this.satelliteResultNameList = [];
			let path = this.$api.riskMonitorApi.getSatelleData;
			let param = {
				taskId: this.taskID,
				parentId: this.parentId,
			};
			this.http.get(path, param).then((res) => {
				if (res.data.success) {
					let result = res.data.data;
					result.forEach((item) => {
						this.satelliteResultNameList.push(item.satellite);
					});
				}
			});
		},

		// //获取卫星name结果
		// getSatelleResult() {
		//   this.satelliteResultNameList = [];
		//   let path = this.$api.taskManageApi.getTreeDataList;
		//   let param = {
		//     taskId: this.taskID,
		//     parentId: this.parentId,
		//   };
		//   console.log(this.taskId);
		//   this.http.get(path, param).then((res) => {
		//     if (res.data.code == 200) {
		//       let satelliteResultList = res.data.data;
		//       console.log(satelliteResultList);
		//       for (let i = 0; i < satelliteResultList.length; i++) {
		//         if (satelliteResultList[i].status == "normal") {
		//           let satalliteName = satelliteResultList[i];
		//           // console.log(satalliteName);
		//           this.satelliteResultNameList.push(
		//             satalliteName.name.split("_")[0].split("-")[0]
		//           );
		//         }
		//       }
		//       this.satelliteResultNameList = new Set(this.satelliteResultNameList);
		//     }
		//   });
		// },

		//矢量文件操作
		selecrShpPath() {
			this.showPushTaskZtreeModal = true;
			this.pushTaskMenu();
		},
		pushTaskMenu(type) {
			let treeObj = $.fn.zTree.getZTreeObj("pushTaskTree");
			if (treeObj != null) {
				var nodes = treeObj.getNodes();
				for (var i = nodes.length - 1; i >= 0; i--) {
					treeObj.removeNode(nodes[i]);
				}
			}

			//1 共享 2 用户 3 推送任务扫描
			let path = this.$api.emergencyMonitorApi.fileRootPath + 1;

			this.pushTaskMenuSetting(path);
		},
		// 应急推送任务扫描目录、生产目录Ztree设置
		pushTaskMenuSetting(urlPath) {
			let checkType = { Y: "", N: "" }; //父与子的关联去掉
			let setting = {
				check: {
					enable: true,
					nocheckInherit: false,
					chkboxType: checkType,
				},
				data: {
					simpleData: {
						enable: true,
					},
				},
				callback: {
					beforeClick: this.beforeClick,
					onClick: this.zTreeOnClick,
					onCheck: this.zTreePushTaskOnCheck,
					onExpand: this.zTreeOnClick,
				},
			};

			this.http.get(urlPath).then((res) => {
				let data = res.data;
				if (data.success == true) {
					$.fn.zTree.init($("#pushTaskTree"), setting, data.data);
				}
			});
		},

		zTreePushTaskOnCheck(event, treeId, treeNode) {
			var treeObj = $.fn.zTree.getZTreeObj(treeId),
				nodes = treeObj.getCheckedNodes(true);

			// if (!treeNode.isParent) {
			//   this.$Message.error("请选择文件夹！");
			//   treeNode.checked = false;
			//   treeObj.updateNode(treeNode);
			//   return;
			// }
			if (nodes.length > 1) {
				//限制单个文件夹
				this.$Message.error("矢量数据只能选择一个！");
				treeNode.checked = false;
				treeObj.updateNode(treeNode);
				return;
			}
		},
		zTreeOnClick(event, treeId, treeNode) {
			let path = this.$api.taskManageApi.getFileListByPath;
			let param = {
				path: treeNode.id,
			};
			var treeObj = $.fn.zTree.getZTreeObj(treeId);
			var node = treeObj.getNodeByParam("id", treeNode.id);
			treeObj.selectNode(node);
			let sNode = treeObj.getSelectedNodes();
			if (sNode.length > 0) {
				let zAsync = sNode[0].zAsync;
				treeObj.reAsyncChildNodes(treeNode, "refresh");
				if (zAsync) {
				} else {
					this.http.get(path, param).then((res) => {
						let data = res.data;
						if (data.success == true) {
							treeNode.halfCheck = false;
							treeObj.addNodes(treeNode, data.data, false);
							sNode[0].zAsync = true;
						}
					});
				}
			}
		},
		async pushTaskMenuOk() {
			let treeObj = $.fn.zTree.getZTreeObj("pushTaskTree"),
				nodes = treeObj.getCheckedNodes(true);
			let tempNode = "";
			let info = "";
			for (var index in nodes) {
				tempNode = nodes[index];
				if (info == "") {
					info = tempNode.id;
				} else {
					info += ";" + tempNode.id;
				}
			}
			if (info.length < 3) {
				this.$Message.error("请选择矢量(.shp)文件！");
				this.pushTaskReset();
			} else {
				let shpFileSufix = info.substr(info.length - 3, info.length);
				if (shpFileSufix.toLowerCase() == "shp") {
					this.shpPath = info;

					let arr = info.split("/");
					let index = arr[arr.length - 1].indexOf(".");
					let shpName = arr[arr.length - 1].substring(0, index);
					let path = this.$api.riskMonitorApi.addShpFileQuery;
					let param = {
						fileName: this.shpPath,
					};
					let res = await this.http.post(path, param);
					if (res.data.code == 200) {
						let shpDataRegion = res.data.data;
						let tempdata1 = {
							geoType: "",
							geoValue: "",
							code: "",
						};

						tempdata1["geoType"] = "polygon";
						tempdata1["geoValue"] = shpDataRegion;
						this.currentRegionList.push(tempdata1);

						//添加关联区域到数据库里
						let wkt = await this.geoJsonToWkt(
							shpDataRegion.features[0].geometry
						);
						let path1 = this.$api.riskMonitorApi.addAssociateArea;
						let param1 = {
							disasterTaskId: this.taskID,
							regionName: shpName,
							regionType: 1,
							regionWkt: wkt,
							taskSource: 12,
						};
						this.http.post(path1, param1).then((res) => {
							if (res.data.code == 200) {
								//获取区域结果ID
								this.regionResultList.push(shpName);
								this.getRegionResultId();
								// 绘制区域
								this.$emit("drawGeometry", shpDataRegion.features[0]);
								this.$Message.success("添加成功");
								this.$emit("refreshRegion");
							} else {
								//获取区域结果ID
								this.getRegionResultId();
								this.$Message.error("添加失败");
							}
						});
					} else {
						this.$Message.error("读取矢量数据失败！！");
					}
					// 绘制区域
					// this.drawGeometry(this.currentImportantRegion.geometries);
				} else {
					this.$Message.error("请选择矢量(.shp)文件！");
				}
				this.pushTaskReset();
			}
		},
		async geoJsonToWkt(geojson) {
			let wkt = "";
			let path = this.$api.emergencyMonitorApi.geoJsonToWkt;
			await this.http.post(path, geojson).then((res) => {
				if (res.data.success) {
					wkt = res.data.data;
				} else {
					this.$Message.error("wkt转换失败");
				}
			});
			return wkt;
		},
		pushTaskMenuCancel() {
			this.pushTaskReset();
		},
		pushTaskReset() {
			var treeObj;
			this.showPushTaskZtreeModal = false;
			treeObj = $.fn.zTree.getZTreeObj("pushTaskTree");
			if (treeObj == null) return;
			var nodes = treeObj.getNodes();
			for (var i = nodes.length - 1; i >= 0; i--) {
				treeObj.removeNode(nodes[i]);
			}
		},

		//区域值改变
		regionChangeEvent(value, selectedData) {
			let valueLen = value.length;
			let type = 0;
			let code = "0";
			if (valueLen == 1) {
				type = 0;
				code = value[0].toString() + "0000";
				this.currentRegionCode = value[0].toString();
				this.currentregionType = type;
				this.currentRegionName = selectedData[0].label;
				//return;
			} else if (valueLen == 2) {
				type = 1;
				code = value[1].toString() + "00";
				this.currentRegionCode = code;
				this.currentregionType = type;
				this.currentRegionName = selectedData[1].__label;
				//code="370104";
			} else if (valueLen == 3) {
				type = 2;
				code = value[2].toString();
				this.currentRegionCode = code;
				this.currentregionType = type;
				this.currentRegionName = selectedData[2].__label;
			}

			this.drawGeometryByCode(code, type);
		},

		// 添加区域结果
		/**tag:region(行政区域 region)   custom（自定义绘制区域ploygon） */
		async addAreaResult(tag) {
			let _this = this;
			let regionName = this.currentRegionName; //默认是行政区域
			let customData = {};
			let importantData = {};
			let regionType = 0;
			//重点区域
			if (tag == "importantRegion") {
				this.importantRegionsList.forEach((item) => {
					if (item.value == _this.importantRegion) {
						return (importantData = item);
					}
				});
				regionName = importantData.label;
				regionType = 0;
			}
			//自定义
			if (tag == "custom") {
				customData = this.customerRegionList.filter((ele) => {
					return ele.id == _this.customerArea;
				})[0];
				regionName = customData.regionName;
				regionType = 1;
			}

			if (this.regionResultList.includes(regionName)) {
				this.$Message.info("该区域已添加，请查看~");
				return;
			}
			this.regionResultList.push(regionName);

			//currentRegion数据更新
			let tempRegionData = {
				geoType: "",
				geoValue: "",
				code: "",
			};
			if (tag === "region") {
				tempRegionData = {
					geoType: "region",
					geoValue: this.currentRegionCode,
					code: this.currentRegionCode,
				};
			} else if (tag == "importantRegion") {
				importantData.value = JSON.parse(
					importantData.value
				).features[0].geometry;
				importantData.value = await this.geoJsonToWkt(importantData.value);
				tempRegionData = {
					geoType: "region",
					geoValue: importantData.value,
					code: importantData.code,
				};
			} else {
				tempRegionData = {
					geoType: "polygon",
					geoValue: customData.regionWkt,
					code: customData.regionCode,
				};
			}
			this.currentRegionList.push(tempRegionData);

			//添加关联区域到数据库里
			let path = this.$api.riskMonitorApi.addAssociateArea;
			let param = {
				disasterTaskId: this.taskID,
				regionName: regionName,
				regionCode: tempRegionData.code,
				regionType: regionType,
				regionWkt: tag == "importantRegion" ? importantData.value : null,
				//tag === "custom" ? customData.regionWkt : "",
				taskSource: 12,
			};
			this.http.post(path, param).then((res) => {
				if (res.data.code == 200) {
					//获取区域结果ID
					this.getRegionResultId();
					this.$Message.success("添加成功");
					this.$emit("refreshRegion");
				} else {
					//获取区域结果ID
					this.getRegionResultId();
					this.$Message.error("添加失败");
					this.regionResultList.pop(regionName);
				}
			});
		},
		//自定义添加区域范围
		getcustomRegeion(wkt, featureName) {
			this.regionResultList.push(featureName);
			let tempRegionData = {
				geoName: featureName,
				geoType: "polygon",
				geoValue: wkt,
			};
			this.currentRegionList.push(tempRegionData);
			console.log(this.regionResultList, this.currentRegionList);
		},
		// //自定义添加区域范围
		// getcustomRegeion(wkt, featureName) {
		//   this.regionResultList.push(featureName);
		//   let tempRegionData = {
		//     geoName: featureName,
		//     geoType: "polygon",
		//     geoValue: wkt,
		//   };
		//   this.currentRegionList.push(tempRegionData);
		//   console.log(this.regionResultList, this.currentRegionList);
		// },
		// 获取区域结果ID
		getRegionResultId() {
			this.regionResultIDList = [];
			//设置查询区域
			let path = this.$api.riskMonitorApi.queryAssociateArea;
			let param = {
				taskId: this.taskID,
			};
			this.http.get(path, param).then((res) => {
				if (res.data.code == 200) {
					let regionResultLists = res.data.data;
					this.taskAreaList = regionResultLists;
					for (let i = 0; i < regionResultLists.length; i++) {
						let region = regionResultLists[i];
						// 保存ID
						let tempData1 = {
							regionName: region.regionName,
							regionID: region.id,
						};
						this.regionResultIDList.push(tempData1);
					}
				}
			});
		},

		//以下区域结果操作
		async onSelectOption(item, index) {
			let _this = this;
			this.currentSelectRegions = [];
			let obj = {};
			obj.name = item;
			obj.index = index;
			this.currentSelectRegions.push(obj);

			//绘制地图
			this.currentRegionInfo = this.currentRegionList[index];

			if (
				this.currentRegionInfo.geoType == "region" &&
				this.currentRegionInfo.code < 999000
			) {
				let regionCode = this.currentRegionInfo.geoValue.toString();
				let code = "";
				let type = "";
				if (regionCode.length == 2) {
					code = regionCode + "0000";
					type = 0;
				} else if (regionCode.length == 4) {
					code = regionCode + "00";
					type = 1;
				} else {
					code = regionCode;
					type = 2;
				}
				this.selectRegionCode = code;
				this.selectRegionWkt = "";
				this.drawGeometryByCode(code, type);
			} else if (
				this.currentRegionInfo.geoType == "region" &&
				this.currentRegionInfo.code > 999000
			) {
				//重点区域展示问题
				let currentImportantRegions = wktToGeoJson(
					this.currentRegionInfo.geoValue
				);
				let geometry = {};
				if (currentImportantRegions.type == "FeatureCollection") {
					geometry = shpDataRegion.features[0]; //写的有问题 shpDataRegion为无效值
				} else if (currentImportantRegions.type == "Feature") {
					geometry = currentImportantRegions.geometry;
				} else if (currentImportantRegions.type == "Polygon") {
					geometry = currentImportantRegions;
				} else if (currentImportantRegions.type === "MultiPolygon") {
					geometry = currentImportantRegions;
				} else {
					geometry = currentImportantRegions.geometries;
				}
				_this.$emit("drawGeometry", geometry);
			} else {
				this.selectRegionCode = this.currentRegionInfo.code;
				this.selectRegionWkt = this.currentRegionInfo.geoValue;
				let currentImportantRegions;
				let b = this.currentRegionInfo.geoValue;
				let types = typeof b;

				if (types == "object") {
					currentImportantRegions = b;
				} else {
					currentImportantRegions = wktToGeoJson(b); //await this.wktToGeojson(b);
				}
				this.currentRegionInfo.geoValue = currentImportantRegions;
				let geometry = {};
				if (currentImportantRegions.type == "FeatureCollection") {
					geometry = shpDataRegion.features[0]; //写的有问题 shpDataRegion为无效值
				} else if (currentImportantRegions.type == "Feature") {
					geometry = currentImportantRegions.geometry;
				} else if (currentImportantRegions.type == "Polygon") {
					geometry = currentImportantRegions;
				} else if (currentImportantRegions.type === "MultiPolygon") {
					geometry = currentImportantRegions;
				} else {
					geometry = currentImportantRegions.geometries;
				}
				_this.$emit("drawGeometry", geometry);
			}
		},
		//wkt转Geojson
		async wktToGeojson(wkt) {
			let geojson = "";
			let path = this.$api.emergencyMonitorApi.wktToGeoJson;
			await this.http.post(path, { wkt }).then((res) => {
				if (res.data.success) {
					geojson = res.data.data;
				} else {
					this.$Message.error("geojson转换失败,范围显示失败！");
				}
			});
			return geojson;
		},
		// 删除区域
		regionDel() {
			// this.currentRegionList.splice(this.delIndex, 1);
			// let arr = [];
			// this.regionResultList.forEach((item) => {
			//   if (item != this.delRegionName) {
			//     arr.push(item);
			//   }
			// });
			// this.regionResultList = arr;
			// if (this.regionResultList.indexOf() == -1) {
			//   this.$Message.info("删除成功");
			// }
			// this.$emit("removeRegionLayer", "maine");
			let options = this.currentSelectRegions;
			// // if (options[0].index == 0) {
			// //   alert("不可删除首个省市的区域！！！");
			// //   return;
			// // }
			let regionIDIndex = options[0].index;
			let regionResultId = this.regionResultIDList[regionIDIndex].regionID;
			for (let i = 0; i < options.length; i++) {
				this.regionResultList.splice(options[i].index, 1);
				this.currentRegionList.splice(options[i].index, 1);
				this.regionResultIDList.splice(options[i].index, 1);
			}
			let path =
				this.$api.riskMonitorApi.deleteAssociateArea + `${regionResultId}`;

			this.http.delete(path).then((res) => {
				if (res.data.code == 200) {
					//获取区域结果ID
					this.getRegionResultId();
					this.$Message.success("删除成功");
					this.$emit("removeRegionLayer", "maine");
					this.$emit("refreshRegion");
				} else {
					//获取区域结果ID
					this.getRegionResultId();
					this.$Message.error("删除失败");
				}
			});
		},
		// 以上为区域操作结果

		judgeIsChecked(pName, cName) {
			let content = this.selectInfoList;

			for (let i = 0; i < content.length; i++) {
				if (content[i].satellite == pName) {
					if (cName == "") {
						return true;
					} else {
						for (let j = 0; j < content[i].sensors.length; j++) {
							if (cName != "" && content[i].sensors[j] == cName) {
								return true;
							}
						}
					}
				}
			}

			return false;
		},
		/** 卫星传感器选择 */
		selectAddInfoCancel() {
			this.showSelectAddInfoZtreeModal = false;
			//this.updateShow = true;
		},
		selectAddInfoOk() {
			this.selectInfoList = [];
			//this.flowParamList = [];

			//this.curFlowId = -1;
			//this.curInputParamKey = "";
			//this.curOutputParamKey = "";

			let sateList = [];
			let sensorList = [];

			let treeObj = $.fn.zTree.getZTreeObj("selectInfoTree"),
				nodes = treeObj.getCheckedNodes(true);
			let tempNode = "";

			for (let index in nodes) {
				let isExist = false;
				tempNode = nodes[index];

				if (tempNode.pId != null) {
					for (let tempInfo of this.selectInfoList) {
						if (tempInfo.satellite == tempNode.pId) {
							if (sensorList.indexOf(tempNode.id) == -1) {
								sensorList.push(tempNode.id);
							}

							tempInfo.sensors.push(tempNode.id);
							isExist = true;
						}
					}
					if (isExist == false) {
						let tempInfo2 = {
							satellite: tempNode.pId,
							sensors: [tempNode.id],
						};
						if (sensorList.indexOf(tempNode.id) == -1) {
							sensorList.push(tempNode.id);
						}

						sateList.push(tempNode.pId);
						this.selectInfoList.push(tempInfo2);
					}
				}
			}

			let info = "";
			for (let sate of sateList) {
				if (info == "") {
					info = sate;
				} else {
					info += "," + sate;
				}
			}
			this.satellites = info;

			info = "";
			for (let sensor of sensorList) {
				if (info == "") {
					info = sensor;
				} else {
					info += "," + sensor;
				}
			}
			this.sensors = info;

			this.showSelectAddInfoZtreeModal = false;
			//this.addShow = true;

			//this.getFlowInfoList();
		},
		selectAddInfo() {
			let self = this;

			let setting = {
				check: {
					enable: true,
					nocheckInherit: false,
					checkTypeFlag: true,
					callbackFlag: true,
				},
				data: {
					simpleData: {
						enable: true,
					},
				},
				callback: {
					beforeClick: this.beforeClick,
					onClick: this.zTreeOnClick,
					onCheck: this.zTreeOnCheck,
					onExpand: this.zTreeOnClick,
				},
			};

			let path = this.$api.emergencyMonitorApi.queryRelated;
			let param = {
				pageNum: -1,
				pageSize: -1,
			};

			this.http.get(path, param).then((res) => {
				if (res.data.success) {
					self.showSelectAddInfoZtreeModal = true;
					//self.addShow = false;

					let content = res.data.data;
					let ztreeContent = [];
					let SatelliteNameList = [];
					let tempZtreeInfos = [];

					for (let item of content) {
						//当前卫星节点
						let curSatelliteName = item.satelliteName;

						if (SatelliteNameList.indexOf(curSatelliteName) == -1) {
							let isChecked = self.judgeIsChecked(curSatelliteName, "");
							let node = {
								name: curSatelliteName,
								id: curSatelliteName,
								pId: 0,
								checked: isChecked,
							};
							ztreeContent.push(node);
							SatelliteNameList.push(curSatelliteName);

							let tempInfo = {
								satellite: curSatelliteName,
								sensors: [],
							};
							tempZtreeInfos.push(tempInfo);
						}

						item.sensors.forEach((ele, i) => {
							Object.keys(ele).forEach((tempvalue) => {
								let sensor = item.sensors[i][tempvalue];
								for (let tempInfo of tempZtreeInfos) {
									if (
										tempInfo.satellite == curSatelliteName &&
										tempInfo.sensors.indexOf(sensor) == -1
									) {
										tempInfo.sensors.push(sensor);
										let isChecked2 = self.judgeIsChecked(
											curSatelliteName,
											sensor
										);

										let childNode = {
											name: sensor,
											id: sensor,
											pId: item.satelliteName,
											checked: isChecked2,
										};
										ztreeContent.push(childNode);
									}
								}
							});
						});
					}

					$.fn.zTree.init($("#selectInfoTree"), setting, ztreeContent);
				} else {
					self.$Message.error(res.data.message);
				}
			});
		},
		// 取消
		ProductProductionBtn() { },
		getSearchRegion() {
			let areas = [];

			for (let i = 0; i < this.taskAreaList.length; i++) {
				let areaparam = {};
				let data = this.taskAreaList[i];
				areaparam.geoName = data.regionName;
				areaparam.geoType = data.regionType == 1 ? "polygon" : "region"; //目前两种 0是region 1是polygon（自定义区域） ；注意  后续可能会加shp
				areaparam.geoValue = this.taskAreaList[i].regionWkt
					? this.taskAreaList[i].regionWkt
					: this.taskAreaList[i].regionCode; //默认是region
				areas.push(areaparam);
			}

			if (this.taskAreaList.length < 1) {
				//当没有区域选择时把当事件的范围信息传给后端
				let data = this.currentRegionList[0];
				let areaparam = {};
				areaparam.geoName = this.TaskAddress;
				areaparam.geoType = "region";
				areaparam.geoValue = data.geoValue;
				areas.push(areaparam);
			}
			return areas;
		},

		// 保存
		saveEmergencyTask() {
			// 处理区域结果数据   区划+自定义
			let areas = this.getSearchRegion();

			// let geoJson = this.$parent.getCurrentDrawGeometry(); //当前地图绘制范围数据
			// let taskStatus = "";
			// if (this.disasterTaskStatus == 0) {
			//   taskStatus = "complete";
			// } else {
			//   taskStatus = "running";
			// }

			let params = {
				areas: areas,
				id: this.taskID,
				name: this.taskName,
				parentId: this.parentId,
			};

			let path = this.$api.riskMonitorApi.riskTaskupdate;
			this.http.post(path, params).then((res) => {
				if (res.data.code == 200) {
					this.$Message.success(res.data.message);
					this.getRegionResultId(); //刷新任务数据
				} else {
					this.$Message.error(res.data.message);
				}
			});
		},

		// 数据目录树功能
		//data:当前选中的数据列表 item：勾选的当前项
		getTreeNodeInfo(data, item) {
			this.currentSelectData = data;
			console.log('sdhjfhask', data, item);
			if (item.checked) {
				this.getPublishId.push(item.id);
			} else {
				this.getPublishId = this.getPublishId.filter((ele) => {
					return ele !== item.id;
				});
			}
			console.log(this.getPublishId);
			let dataNote0 = []; //根节点
			let dataNote1 = []; //产品级别节点
			let nodes = [];
			this.selcetFilePath = [];
			data.forEach((node) => {
				//勾选的叶子节点数据
				if (!node.children) {
					let filePath = node.path + "/" + node.title;
					this.selcetFilePath.push(filePath);

					nodes.push(node);
				}

				//储存勾选的日期父节点数据
				if (node.title.split("-").length == 3) {
					dataNote0.push(node);
				}

				//勾选的等级节点数据
				if (!node.title.includes(".") && node.title.includes("L")) {
					dataNote1.push(node);
				}
				this.nodes = nodes;
				this.dataNote1 = dataNote1;
				this.dataNote0 = dataNote0;
			});
			// 右侧默认勾选
			// this.checkData = []
			// this.selcetFilePath.forEach((item) => {
			//   let obj = {
			//     name: item,
			//   }
			//   this.checkData.push(obj);
			// })
			// this.checkDataTotal = this.checkData.length;
			// console.log(this.checkDataTotal)

			this.$emit("upDateLeaf", this.selcetFilePath);
			//this.$emit("updateDir", this.selcetFilePath);
			// this.getTile(nodes);
			this.loadShpAndImg(item, "beforeMap");
		},
		removeLayer(layerID) {
			if (this.map.getLayer(layerID)) {
				this.map.removeLayer(layerID);
			}
			if (this.map.getSource(layerID)) {
				this.map.removeSource(layerID);
			}
			if (this.afterMap.getLayer(layerID)) {
				this.afterMap.removeLayer(layerID);
			}
			if (this.afterMap.getSource(layerID)) {
				this.afterMap.removeSource(layerID);
			}
		},
		//加载树节点数据到地图中
		loadShpAndImg(node, mapDiv) {
			console.log('node', node);
			let dataNote0 = this.dataNote0;
			let dataNote1 = this.dataNote1;
			let nodes = this.nodes;
			//当前勾选的是叶子节点
			if (!node.children && node.checked == true) {
				dataNote1.forEach((l) => {
					if (JSON.stringify(l.children).indexOf(JSON.stringify(node)) != -1) {
						dataNote0.forEach((d) => {
							if (JSON.stringify(d.children).indexOf(JSON.stringify(l)) != -1) {
								this.showImg(node, mapDiv);
							}
						});
					}
				});
			} else if (!node.children && node.checked == false) {
				// let imgPath = node.path + "/" + node.title;
				// let layerID = "picture" + imgPath;
				let layerID = "";
				if (
					node.title.includes(".tif") ||
					node.title.includes(".img") ||
					node.title.includes(".jpg")
				) {
					let imgPath = node.path + "/" + node.title;
					layerID = "picture" + imgPath;
				} else {
					layerID = node.id;
				}
				console.log("移除", layerID);
				if (node.checked ? false : true) {
					this.removeLayer(layerID);
				} else if (mapDiv === "afterMap") {
					this.removeLayer(layerID);
				} else if (mapDiv === "beforeMap" && this.map.getLayer(layerID)) {
					this.$Message.info("当前地图已添加该影像，请勿重复加载！");
					return;
				}
			}
			//勾选父节点。
			if (
				!node.title.includes(".") &&
				node.title.includes("L") &&
				node.checked == true
			) {
				for (let i = 0; i < nodes.length; i++) {
					console.log(node, "nodechildren");
					console.log(nodes[i], "nodes[i]");
					let a = JSON.stringify(node.children).indexOf(
						JSON.stringify(nodes[i])
					);
					console.log(a, "a");
					if (
						JSON.stringify(node.children).indexOf(JSON.stringify(nodes[i])) !=
						-1
					) {
						console.log("op");
						dataNote0.forEach((d) => {
							if (
								JSON.stringify(d.children).indexOf(JSON.stringify(node)) != -1
							) {
								console.log("lll");
								this.showImg(nodes[i], mapDiv);
							}
						});
					}
				}
			} else if (
				!node.title.includes(".") &&
				node.title.includes("L") &&
				node.checked == false
			) {
				for (let i = 0; i < nodes.length; i++) {
					if (
						JSON.stringify(node.children).indexOf(JSON.stringify(nodes[i])) !=
						-1
					) {
						console.log(nodes);
						let layerID = "";
						if (
							nodes[i].title.includes(".tif") ||
							nodes[i].title.includes(".img") ||
							nodes[i].title.includes(".jpg")
						) {
							let imgPath = nodes[i].path + "/" + nodes[i].title;
							layerID = "picture" + imgPath;
						} else {
							layerID = nodes[i].id;
						}
						// let imgPath = nodes[i].path + "/" + nodes[i].title;
						// let layerID = "picture" + imgPath;
						// let layerID = nodes[i].id
						if (nodes[i].checked ? true : false) {
							this.removeLayer(layerID);
						} else if (mapDiv === "afterMap") {
							this.removeLayer(layerID);
						} else if (mapDiv === "beforeMap" && this.map.getLayer(layerID)) {
							return;
						}
					}
				}
			}
			//勾选日期节点
			if (node.title.split("-").length == 3 && node.checked === true) {
				console.log(node, "nodeo");
				for (let i = 0; i < dataNote1.length; i++) {
					let b = JSON.stringify(node.children).indexOf(
						JSON.stringify(dataNote1[i])
					);
					console.log(b, "b");
					if (
						JSON.stringify(node.children).indexOf(
							JSON.stringify(dataNote1[i])
						) != -1
					) {
						console.log(node, "node1");
						for (let j = 0; j < nodes.length; j++) {
							if (
								JSON.stringify(dataNote1[i].children).indexOf(
									JSON.stringify(nodes[j])
								) != -1
							) {
								console.log("zuihou ");
								this.showImg(nodes[j], mapDiv);
							}
						}
					}
				}
			} else if (node.title.split("-").length == 3 && node.checked == false) {
				for (let i = 0; i < node.children.length; i++) {
					for (let j = 0; j < node.children[i].children.length; j++) {
						let layerID = "";
						console.log(node);
						if (
							node.children[i].children[j].title.includes(".tif") ||
							node.children[i].children[j].title.includes(".img") ||
							node.children[i].children[j].title.includes(".jpg")
						) {
							let imgPath =
								node.children[i].children[j].path +
								"/" +
								node.children[i].children[j].title;
							layerID = "picture" + imgPath;
						} else {
							layerID = node.children[i].children[j].id;
						}

						if (node.children[i].children[j].checked ? true : false) {
							this.removeLayer(layerID);
						} else if (mapDiv === "afterMap") {
							this.removeLayer(layerID);
						} else if (mapDiv === "beforeMap" && this.map.getLayer(layerID)) {
							return;
						}
					}
				}
			}
		},

		showImg(node, mapDiv) {
			if (node.level.includes("L1") && !node.title.endsWith(".shp")) {
				//  L1A数据加载
				this.getFirstA(node.id, node.checked ? true : false, mapDiv);
			} else if (
				node.region != null &&
				node.level.includes("L2") &&
				!node.title.endsWith(".shp")
			) {
				// L1A数据加载
				this.getFirstA(node.id, node.checked ? true : false, mapDiv);
			} else if (!node.level.includes("L1") && !node.title.endsWith(".shp")) {
				// 瓦片数据加载
				let path = node.path + "/" + node.title;
				this.getInfo([path], node.checked ? true : false, mapDiv);
			} else if (node.title.endsWith(".shp")) {
				// 矢量数据加载
				this.getRegionByShp(node, node.checked ? true : false);
			}
		},
		showImgFire(node, mapDiv) {
			if (node.level.includes("L1") && !node.title.endsWith(".shp")) {
				//  L1A数据加载
				this.getFirstAFire(node.id, node.checked ? true : false, mapDiv);
			} else if (
				node.region != null &&
				node.level.includes("L2") &&
				!node.title.endsWith(".shp")
			) {
				// L1A数据加载
				this.getFirstAFire(node.id, node.checked ? true : false, mapDiv);
			} else if (!node.level.includes("L1") && !node.title.endsWith(".shp")) {
				// 瓦片数据加载
				let path = node.path + "/" + node.title;
				this.getInfoFire([path], node.checked ? true : false, mapDiv);
			} else if (node.title.endsWith(".shp")) {
				// 矢量数据加载
				this.getRegionByShpFire(node, node.checked ? true : false);
			}
		},

		//获得切片 //暂时不用 函数loadShpAndImg代替
		getTile(data) {
			console.log(data, "data89");
			let L1aArr = [];
			let tilePathArr = [];
			let shpArr = [];
			if (data.length > 0)
				for (let node of data) {
					console.log(node, "node");
					if (node.level.includes("L1") && !node.title.endsWith(".shp")) {
						L1aArr.push(node.id);
					} else if (
						node.region != null &&
						node.level.includes("L2") &&
						!node.title.endsWith(".shp")
					) {
						L1aArr.push(node.id);
					} else if (
						!node.level.includes("L1") &&
						!node.title.endsWith(".shp")
					) {
						tilePathArr.push(node.path + "/" + node.title);
					} else if (node.title.endsWith(".shp")) {
						shpArr.push(node);
					}
				}
			this.selectTileData = tilePathArr;
			//----L1A数据加载---------------
			let temp3 = this.getTreeNodeOfOperation(L1aArr, this.lastX1);
			if (temp3.path.length > 0) this.getFirstA(temp3.path[0], temp3.isShow);
			this.lastX1 = L1aArr;
			//------瓦片数据加载-------------
			let temp1 = this.getTreeNodeOfOperation(tilePathArr, this.lastX2);
			console.log(temp1, "temp1");
			if (temp1.path.length > 0) this.getInfo(temp1.path, temp1.isShow);
			this.lastX2 = tilePathArr;
			//------矢量数据加载-------------
			let temp2 = this.getTreeNodeOfOperation(shpArr, this.lastShp);
			if (temp2.path.length > 0)
				this.getRegionByShp(temp2.path[0], temp2.isShow);
			this.lastShp = shpArr;
		},

		//得到树节点的操作的当前节点的显示还是取消
		/**currentNodeArr: 当前目录树选择的所有符合的树节点;lastNodeArr:上一次目录树选中的树节点*/
		getTreeNodeOfOperation(currentNodeArr, lastNodeArr) {
			let result = {
				path: [],
				isShow: false,
			};
			if (currentNodeArr.length > lastNodeArr.length) {
				//勾选数据
				result.path = currentNodeArr.filter((ele) => {
					return !lastNodeArr.includes(ele);
				});
				result.isShow = true;
			} else if (currentNodeArr.length < lastNodeArr.length) {
				//取消勾选
				result.path = lastNodeArr.filter((ele) => {
					return !currentNodeArr.includes(ele);
				});
				result.isShow = false;
			}
			return result;
		},
		// 右键查看元数据样式
		handleContextMenu(data) {
			console.log(data, "data123");
			this.currentTreeNode = data;
		},
		// 元数据查看
		async metadataView() {
			const path = this.$api.taskManageApi.queryAssociateDataById + this.currentTreeNode.id;
			const { data } = await axios.get(path);
			if (!data.success) {
				this.$Message.error("查询元数据失败");
				return;
			}
			this.imgDetails = data.data;

			if (data.data.meta) {
				this.dataMeta = this.$x2js.xml2js(data.data.meta); //xml为需要转换的字符串xml
				console.log(this.dataMeta);
				this.dataMeta = this.dataMeta.ProductMetaData;
				let imgReceiveTime
				if (this.dataMeta.ReceiveTime != "NULL") {
					imgReceiveTime = this.dataMeta.ReceiveTime
				} else {
					let currentTime = Date.parse(new Date())
					imgReceiveTime = this.timestampToTime(currentTime / 1000);
				}
				if (this.dataMeta.SatelliteID != "GF4") {
					imgReceiveTime = imgReceiveTime.trim().split(/\s+/);
					let day = imgReceiveTime[0].trim().split("-");
					let hour = imgReceiveTime[1].trim().split(":");
					let time = Number(hour[0]) + 8;
					let years = Number(day[0]);
					if (time > 23) {
						day[2] = Number(day[2]) + 1;
						time = time - 24;
						day[1] = Number(day[1]);
						if (day[2] === 29) {
							if (day[1] === 2) {
								if (years % 100 === 0 && years % 400 === 0) {
									day[2] = day[2];
								} else if (years % 100 != 0 && years % 4 === 0) {
									day[2] = day[2];
								} else {
									day[1] = 3;
									day[2] = 1;
								}
							} else {
								day[1] = day[1];
							}
						} else if (day[2] === 30) {
							if (day[1] != 2) {
								day[1] = day[1];
								day[2] = day[2];
							} else {
								day[1] = day[1] + 1;
								day[2] = 1;
							}
						} else if (day[2] === 31) {
							if (
								day[1] === 4 ||
								day[1] === 6 ||
								day[1] === 9 ||
								day[1] === 11
							) {
								day[1] = day[1] + 1;
								day[2] = day[2] - 30;
							} else {
								day[2] = day[2];
							}
						} else if (day[2] === 32) {
							if (day[1] != 12) {
								day[1] = day[1] + 1;
								day[2] = day[2] - 31;
							} else {
								day[1] = 1;
								day[2] = day[2] - 31;
								day[0] = Number(day[0]) + 1;
							}
						}
					}
					if (day[1] < 10) day[1] = day[1];
					if (day[2] < 10 && day[2].length != 2) day[2] = "0" + day[2];
					imgReceiveTime =
						day[0] +
						"-" +
						day[1] +
						"-" +
						day[2] +
						" " +
						time +
						":" +
						hour[1] +
						":" +
						hour[2];
					this.imgReceiveTime = imgReceiveTime;
				} else {
					this.imgReceiveTime = imgReceiveTime;
				}
				this.metadataViewShow = true;
			} else {
				this.metadataViewShow = false;
				this.$Message.error("无元数据信息");
			}
		},
		//格式化时间
		timestampToTime(timestamp) {
			var date = "";
			//时间戳为10位需*1000，时间戳为13位的话不需乘1000
			if (timestamp.length != 13) {
				date = new Date(timestamp * 1000)
			} else {
				date = new Date(timestamp)
			}
			var Y = date.getFullYear() + '-';
			var M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
			var D = (date.getDate() < 10 ? '0' + date.getDate() : date.getDate()) + ' ';
			var h = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) + ':';
			var m = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) + ':';
			var s = date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds();
			return Y + M + D + h + m + s;
		},
		// 添加
		addTreeData() {
			let _this = this;
			this.fileCatalogModal = true; // 打开弹框
			this.addFileLevelModal = false;
			this.$nextTick(() => {
				_this.$refs.refFileCatalogModal.initFileTree(
					{
						type: { name: "file" },
						constraint: { extensions: "*.zip,*.tar.gz" },
					},
					false
				);
				_this.$refs.refFileCatalogModal.handleShow(true);
			});
		},

		// 数据恢复
		recoverTreeData() {
			this.recoverShow = true;
			let path = this.$api.taskManageApi.getTreeDataList;
			let param = {
				taskId: this.taskID,
				parentId: this.parentId,
				status: "delete",
			};
			this.http.get(path, param).then((res) => {
				if (res.data.code == 200) {
					this.recoverData = res.data.data;
				} else {
					this.recoverData = [];
				}
			});
		},
		async recoverDataOk() {
			this.recoverShow = false;
			let flag = 0;
			let path = this.$api.taskManageApi.riskUpdateTree;
			for (let i = 0; i < this.recoverNodeList.length; i++) {
				let param = {
					id: this.recoverNodeList[i].id,
					status: "normal",
				};
				await this.http.post(path, param).then((res) => {
					if (res.data.code == 200) {
						flag++;
					} else {
					}
				});
			}
			if (flag == this.recoverNodeList.length) {
				this.$Message.success("恢复成功！");
				this.getTreeDataList();
			} else if (flag == 0) {
				this.$Message.error("恢复失败！");
				this.getTreeDataList();
			} else {
				this.$Message.error("部分恢复失败！");
				this.getTreeDataList();
			}
		},
		selectedData(selection) {
			this.recoverNodeList = selection;
		},

		// 下载
		async downloadTreeData() {
			let path = this.$api.emergencyMonitorApi.queryFiles;
			let param = [];
			// param.push({
			//   excludeFilter: "",
			//   includeFilter: "",
			//   path: "",
			//   suffixFilter: "",
			// });
			console.log("00");
			this.selcetFilePath.forEach((ele) => {
				let folder = ele.substring(0, ele.lastIndexOf("/"));
				let index = param.filter((m) => {
					return m.path == folder;
				});
				if (index.length < 1) param.push({ path: folder });
			});

			let filePathList = [];
			await this.http.post(path, param).then((res) => {
				if (res.data.success) {
					for (var item in res.data.data) {
						filePathList = [...filePathList, ...res.data.data[item]];
					}
				}
			});
			let url = this.$api.processingApi.downloadReport + filePathList;
			window.open(url);
		},
	},
};
</script>
<style lang="scss" >
.el-cascader-panel .el-radio__inner {
	width: 100%;
	height: 100%;
	z-index: 10;
	position: absolute;
	top: 10px;
	right: -10px;

}

.el-cascader-panel .el-radio__input.is-checked .el-radio__inner {
	display: none;
}

.pubulishSetting .el-input--medium .el-input__inner {
	height: 30px;
	line-height: 30px;
}

#leftInner {
	margin: 0 20px;
	height: calc(100vh - 267px);
}

#leftInner .iconBtn {
	height: 1.2em !important;
}

#leftInner .iconBtn:hover {
	opacity: 1 !important;
}

#leftInner .iconBtn.delete:hover {
	opacity: 0.8 !important;
}

#leftInner .tab-header {
	font-size: 1.2em;
	color: #5290e8;
	font-weight: bold;
	margin: 6px 0;
}

#leftInner .topBtnGroup {
	display: flex;
	position: relative;

	color: #5290e8;
}

#leftInner .topBtnGroup button {
	flex: 1;
	border: none;
}

#leftInner .topBtnGroup button:hover {
	border-bottom: 1px solid #5290e8;
}

#leftInner .topBtnGroup img {
	box-sizing: unset;

	position: absolute;
	top: -10px;
	right: -35px;
	height: 40px !important;
	border-radius: 50%;
	z-index: 3;
}

#taskDescription div,
#samePeriod div {
	display: flex;
	align-items: center;
	margin-top: 5px;
}

#taskDescription span,
#samePeriod span {
	display: inline-block;
	width: 80px;
	text-align: right;
	color: #666666;
}

#taskDescription .ivu-input-wrapper,
#samePeriod .ivu-input-wrapper {
	flex: 1;
	margin-left: 20px;
}

#spatialRegion .tab {
	background-color: #e3f1ff;
}

#spatialRegion .btnGroup,
#spatialRegion .regionBlock {
	display: flex;
}

// TODO: need to add a focus class if selected
#spatialRegion .btnGroup button {
	flex: 1;
	box-sizing: border-box;
	border: none;
	padding: 4px;
	text-align: center;
	color: black;
	background-color: transparent;
	height: 40px;
}

#spatialRegion .btnGroup button.focus,
#spatialRegion .btnGroup button:hover {
	color: #5290e8;
	border-bottom: 1px solid #5290e8;
}

#spatialRegion .regionBlock {
	align-items: center;
}

#spatialRegion .regionBlock div,
#spatialRegion .regionBlock button {
	margin: 4px;
}

#spatialRegion .regionBlock div {
	flex: 1;
}

#spatialRegion .regionBlock button {
	margin: 0 10px;
	width: 60px;
	height: 100%;
}

#regionResult select {
	width: 100%;
}

#samePeriod .chooseArea {
	margin: 10px 0;
}

#sensorChoose button {
	padding: 0 10px;
	height: 100%;
	margin-left: 10px;
}

#samePeriod div {
	margin-bottom: 6px;
}

#samePeriod div .ivu-input-wrapper {
	width: 80%;
}

#productLevel {
	margin-bottom: 10px;
}

#leftDrawer #closeBtn {
	position: absolute;
	top: 0;
	right: 0;
	z-index: 5;
}

#leftDrawer Tree {
	position: absolute;
	top: 0;
	right: 0;
	z-index: 5;
}

#leftInner .formBtnGroup {
	display: flex;
	justify-content: center;
}

#leftInner .formBtnGroup button {
	margin-top: 20px;
	margin: 8px;
}

#treeData {
	margin-top: 20px;
	width: 100%;
	height: 100%;
	overflow: auto;
}

#treeData .btnGroup {
	display: flex;
	// flex-wrap: wrap;
	justify-content: space-between;
	width: 240px;
	position: absolute;
	margin-left: 10px;
	// margin-left: -20px;
	bottom: 80px;
}

#treeData .publish {
	display: flex;
	justify-content: space-between;
	width: 240px;
	position: absolute;
	margin-left: 13px;
	// margin-right: 2px;
	bottom: 45px;
}

.pubulishSetting {
	display: flex;
	// flex-direction: column;
	flex-wrap: wrap;
	justify-content: center;
}

.queryBox {
	border: 2px solid #DCDEE2;
	padding: 20px 10px 0px 10px;
	border-radius: 5px;
	margin-bottom: 30px;
}

#treeData .btnGroup button {
	padding: 4px, 8px;
	margin: 4px;
}

#downloadSetting .btnGroup {
	display: flex;
	justify-content: center;
}

#downloadSetting .btnGroup button {
	margin: 20px;
}

#downloadSetting .ivu-input-wrapper {
	display: inline;
}

#modaldata div {
	display: flex;
	flex-direction: column;
	width: 600;
	margin: 0 auto;
}

.dataDetails {
	display: flex;
	flex-direction: column;
	margin: 0 auto;
	width: 300;
}

.dataDetails div {
	font-size: 1.2em;
	margin: 8px 0;
	width: 400;
}

.dataDetails td {
	padding: 4px;
	border: 0.1px solid #f5f5f5;
}

.style-choice {
	display: flex;
	height: 200px;
	margin-top: 10px;
	border: solid 0.1px #f5f5f5;
}

.download-text {
	margin-bottom: 20px;
}

.download-content {
	margin-top: 10px;
}

.download-button {
	margin-top: 30px;
}

#styleapply button {
	flex: 1;
	border: none;
	padding: 4px, 4px, 4px, 4px;
	text-align: center;
	width: 120px;
	font-size: 1em;
	margin-left: 10px;
}

.crimson-text {
	font-size: 12px;
}

.stylebutton button {
	margin-top: 15px;
	border: solid 0.2px #f5f5f5;
}

.colorbar_box {
	position: relative;
	line-height: 28px;
	margin-left: 20px;

	.colorbar_ipt {
		width: 83%;
		cursor: pointer;
		border: none;
		padding: 0;
		height: 50px;
	}

	i {
		position: absolute;
		right: 9px;
		top: 7px;
		color: #c0c4cc;
		font-size: 15px;
		margin-left: 20px;
	}

	i.active {
		transform: rotate(-180deg);
		transition: transform 0.3s;
		margin-left: 20px;
	}

	ul,
	li {
		list-style: none;
		margin-left: 20px;
	}

	ul {
		padding: 0;
		margin: 0;
		border: 1px none #ccc;
		width: 90%;
		box-shadow: 2.5 0 8px #dedede;
		height: 115px;
		overflow: auto;
		margin-left: 21px;
		// position: absolute;
		// top: 30px;
		// left: 0;
		// z-index: 2000;
	}

	li {
		height: 22px;
		cursor: pointer;
		// color: black;
		line-height: 22px;
		padding: 0 10px;
		box-shadow: 2.5 0 4px #dedede;
		border-bottom: 1px none #fff;
		margin-left: 21px;
	}
}

.ivu-select-single .ivu-select-selection .ivu-select-placeholder {
	line-height: 20px;
}

.dataManagementModal .ivu-modal-body {
	padding: 0 16px;
}

.deleteManagementModal .ivu-modal-body {
	padding: 0 16px;
}

.ivu-select-single .ivu-select-selection .ivu-select-placeholder {
	line-height: 30px;
}
</style>